using System.Runtime.InteropServices;
public class Program
{
[DllImport(@"C:\Users\Abc\Documents\visual studio 2015\Projects\ConsoleApplication4\ConsoleApplication4\aws-encryption-sdk.dll", EntryPoint = "aws_cryptosdk_keyring_on_decrypt", CallingConvention = CallingConvention.StdCall)]
public static extern void aws_cryptosdk_keyring_on_decrypt(ref IntPtr value);
static void Main(string[] args)
{
int value = 6;
IntPtr sptr = Marshal.StringToHGlobalAnsi((value).ToString());
aws_cryptosdk_keyring_on_decrypt(ref sptr);
Console.WriteLine("called");
Console.Read();
}
}
I have tried with the above code. But getting error badimageformat exception. After changing cpu format 64 to 32 bit also i am getting the below error.
An unhandled exception of type 'System.BadImageFormatException' occurred in ConsoleApplication4.exe Additional information: An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B)
User contributions licensed under CC BY-SA 3.0