I am trying to build a CF application that calls unmanaged code. I use PInvoke (I've tried both VB.Net with Declare and <DllImport> and C# with [DllImport]) but everytime I get SystemMissingMethodException.

I am using Visual Studio .Net 2003, Pocket PC 2002 (emulator), and CF 1.0 RTM on the emulator.

The unmanage code is written in C with _cdecl calling convention. I've used DirectoryInfo and confirmed that the dll is in the directory with my CF application. I've also run dumpbin.exe to confirm the function name in the dll.

Are there any problems with this early version of the compact framework (CF 1.0 RTM)? Would they account for this problem? I've download CF 1.0 SP3, but I'm not sure how to load it into the emulator. ActiveSync as a stand alone program does not connect with the emulator.

Here is a snapshot of my PInvoke code for VB.net:

Declare Function Mytst Lib "Mydll.dll" () As Int


<DllImport("Mydll.dll", CharSet:=CharSet.Auto, _
CallingConvention:=CallingConvention.Winapi _
)> _
Public Function Mytst() As Int
End Function

Dim Myret as int
Myret = Mytst

Neither one works.

Any other thoughts.