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