The following line is generating a runtime error in a C# GUI:
int x = myclass.number_from_dll(); I'm using Microsoft Visual Studio 2008.
The code in C# is:
class myclass { [DllImport("strat_gr_dll.dll", EntryPoint = "number_from_dll")] public static extern int number_from_dll(); } The code in the C++ .dll is:
// This is an example of an exported function. DLL int number_from_dll(void) { return 42; } The runtime error from .NET is:
An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B)