C#调用C语言的DLL
C#调用C语言实现的DLL时,出现CoTaskMemFree(IntPtr ptr ) 的错误,查了一下,感觉是参数没有对应上,哪位大侠帮我看看是哪里的问题好吗,跪谢~
C语言被调用代码:
test.dll
__declspec(dllexport) char* fun(DWORD mode,const char* password);
char* fun( DWORD mode, const char* password);
C#调用侧代码:
static String code;
[DllImport("test.dll", CharSet = CharSet.Ansi)]
public static extern String fun(int mode, String password);
static void Main(string[] args)
{
String s = "123";
code = obl_crypto_hash(5, s);
}