Blond Mobile


Archive for the ‘DLLImport’ Category

PInvoke /DLLImport for Windows Mobile

Wednesday, March 26th, 2008

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") 

Jajah is the VoIP player that brought you web-activated telephony.