我正在使用 C# WPF。
我有一个 C++ 测试 dll 如下:
.h:
extern "C" __delspec(dllexport) void TestMethod();
.cpp 文件:
extern "C"
{
__delspec(dllexport) void TestMethod()
{
MessageBox(0, L"Test", L"Test", MB_ICONINFORMATION);
}
}
C#代码:
[DllImport("DllTest.dll", EntryPoint = "TestMethod")]
public static extern void TestMethod();
当我试图调用 TestMethod 时,我遇到了异常:
an attempt was made to load a program with an incorrect format
我做错了什么?
谢谢!