PInvoke /DLLImport for Windows Mobile
Using a Native DLL (c++) in a managed (c#) project is straightforward. you just write the following in your managed code:
[DllImport("coredll.dll")] public static extern bool CeRunAppAtEvent(string AppName, int Event);
and use the native function like it was managed.
The problem happens when you want to write your own native dll. It seems that the function in the native code must look like this
extern "C" __declspec(dllexport) void function()
confusing a bit, since when not programming for Windows Mobile you may also write your native function without extern "C" and add the EntryPoint attribute, and it will work… (for Windows Mobile this is not the case, you have to make sure you write extern "C")
Tags: CeRunAppAtEvent, Coredll, DLLImport, extern, PInvoke, Windows Mobile