下面一行是在C#GUI生成運行時錯誤:調用從C#中的C++的.dll引發運行時錯誤
int x = myclass.number_from_dll();
我使用Microsoft Visual Studio 2008
中的代碼C#是:
class myclass
{
[DllImport("strat_gr_dll.dll", EntryPoint = "number_from_dll")]
public static extern int number_from_dll();
}
在C++的.dll的代碼是:
// This is an example of an exported function.
DLL int number_from_dll(void)
{
return 42;
}
從.NET運行時錯誤是:
An attempt was made to load a program with an incorrect format.
(Exception from HRESULT: 0x8007000B)
您是否用友好名稱導出該功能? – 2010-08-02 19:13:16