How to solve .NET CF "Cannot Find PInvoke DLL" Problem?

These are all C # gurus. For several seconds I was banging my head about it, I tried all kinds of tips on the network to no avail. The action takes place in Windows Mobile 5.0.

I have a DLL named MyDll.dll. In MyDll.h I have:

extern "C" __declspec(dllexport) int MyDllFunction(int one, int two);

The definition of MyDllFunction in MyDll.cpp:

int MyDllFunction(int one, int two)
{
    return one + two;
}

The C # class contains the following declaration:

[DllImport("MyDll.dll")]
extern public static int MyDllFunction(int one, int two);

In the same class, I call MyDllFunction as follows:

int res = MyDllFunction(10, 10);

And here it is damn holding me "I can not find the PInvoke dll MyDll.dll". I checked that I can actually make PInvoke for system calls such as "GetAsyncKeyState (1)" declared as:

    [DllImport("coredll.dll")]
    protected static extern short GetAsyncKeyState(int vKey);

MyDll.dll is located in the same folder as the executable file, and I also tried to put it in the / Windows folder without changes and success. Any tips or solutions are welcome.

+5
4

, , DLL ? IIRC, Windows Mobile .

+2

, . , "", , , "flaky". - , PPC (a), DLL - , CLR ( , Windows - , -), (b) CLR ( ..), (c) CLR , (, 't dll')

"Windows Mobile" , .

+4

, , pinvoke, , : MyDll.dll ThreadBenchLib.dll . ?

, DLL . DLL - .

0

. Depends.exe dll WinCE dll debug. (MSVCR90D.dll) , , .

0

All Articles