import DLL -> MissingMethodException

  • Thread starter Thread starter keith
  • Start date Start date
K

keith

Hi all,

I have a simple C++ dll (regular MFC), want to import it into a simple
pocket pc '03 c# app.
Think I'm doing everything right, but on my device I get the
MissingMethodException error. I do have the .DLL included in my C#
project (as content). And I've used DumpBin to prove that the
function is exported correctly and it is. And I created a C# windows
app and imported it correctly as well. Any ideas?
Here's my code:

C++ dll:
--------------------------------------------------------
#include "stdafx.h"
BOOL APIENTRY DllMain( HANDLE hModule, DWORD ul_reason_for_call,
LPVOID lpReserved )
{
return TRUE;
}

extern "C" __declspec(dllexport) void SetSuspendTimeouts();

__declspec(dllexport) void SetSuspendTimeouts()
{
//don't even do anything yet, just want import to work first
}
---------------------------------------------------------------

C# pocket pc app:
-----------------------------------------------------------------
.....
[DllImport("suspendTestDLL.dll", EntryPoint="SetSuspendTimeouts")]
public static extern void SetSuspendTimeouts();
public Form1()
{ ...
try
{
SetSuspendTimeouts();
}
catch(Exception ex)
{
System.Windows.Forms.MessageBox.Show(ex.Message);
}
}
-------------------------------------------------------------------

dumpbin /exports suspendTestDLL.dll:
Dump of file suspendTestDLL.dll

File Type: DLL

Section contains the following exports for suspendTestDLL.dll

0 characteristics
424F3653 time date stamp Sat Apr 02 19:18:27 2005
0.00 version
1 ordinal base
1 number of functions
1 number of names

ordinal hint RVA name

1 0 0000100F SetSuspendTimeouts

Summary

4000 .data
1000 .idata
3000 .rdata
2000 .reloc
28000 .text
 
Does the DLL build match the device? Check the bin directory on the desktop
 
I'm not sure I'm exactly following you. Do you mean the build
processor type? My device is an armv4, and I wasn't aware of being
able to select what processor type the build could be; I just selected
a MFC DLL project and went from there. Is this what you're referring
to, or am I not even in the ballpark?
Thanks again.
 
That means you've used VS 2003 to build the DLL, correct? If so, it won't
work.
Not only VS would produce x86 DLL, it will produce Win32 x86 DLL, so it
won't work even on x86 CE.
You have to use eVC (free download) to compile this DLL, not VS.
eVC would allow you to choose correct CPU.

Best regards,

Ilya

This posting is provided "AS IS" with no warranties, and confers no rights.
 
That is correct and it works, thanks for your responses, truly
appreciate them.
 
Back
Top