Use the DllImport attribute that is a member of the System.Runtime.InteropServices namespace. Assume your exported function found in MyDLL.dll has a signature:
int MyFunction( LPCTSTR lpCaption, UINT uType);
The code below shows how you can access this function from within C#.
using System;
using System.Runtime.InteropServices;
class HelloWorld
{
[DllImport('mydll.dll')]
public int MyFunction(string title, int type);
public static void Main()
{
int nReturnValue = MyFunction('some string', 14);
}
}
Share with