我从C#调用非托管方法(C ++)时收到 System.EntryPointNotFoundException ,其中“bool”为参数。
以下是C ++中的函数声明
__declspec(dllexport) void _stdcall MethodA(bool Flag);
我在搜索了一段时间之后,在C#中使用了以下代码。但我仍然得到同样的例外。
[DllImport("UnmanagedDLL.dll")]
private static extern void MethodA([MarshalAs(UnmanagedType.I1)] bool Flag);
我也尝试过使用 Byte ,布尔& int 类型而不是bool,我仍然得到相同的异常。
请有人帮我解决问题。
提前致谢 User2794477