How to use DLLExport in C# as we are using in C language

Apr 2 2014 6:49 AM
Hi All,
 
I have some methods written in c language. I am using those methods in a scripting language by exporting dll using below code
 
extern DllExport void method_name(int a, int b) {}
 
now I have to use C# instead of c language to comunicate with scripting language. I have tried below DLLExport example but failed.
 
class Test
{
[DllExport("add", CallingConvention = CallingConvention.Cdecl)]
  public static int TestExport(int left, int right)
  {
     return left + right;
  }
}
 
Can anyone help me in using DLLExport in c#.  What are the references to be imported. Includes that need to be added. etc.
 
Thanks in advance.

Answers (1)