Click here to Skip to main content
15,890,399 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I need to call a function which is in aws-encryption-sdk dll in my console application.But i am getting error when the function is called. Can someone guide me how to proceed for this.

What I have tried:

C#
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();
        }
    }
Posted
Updated 22-Oct-19 22:12pm
v2
Comments
Richard Deeming 23-Oct-19 11:29am    
If you want someone to help you fix an error message, then you need to tell us what the error message is.

Click the green "Improve question" link and add the full details of the error to your question.

1 solution

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900