C++ DLL to C# Compact Framework

Status
Not open for further replies.

islouis

Junior Member level 1
Joined
Sep 24, 2004
Messages
17
Helped
1
Reputation
2
Reaction score
0
Trophy points
1,281
Activity points
194
Dear Sir:

Im doing a project to build a DLL file in EVC++ and porting to WinCE with C#.(so C# will use the DLL file).

I have tried to use EVC C++ with the C++ DLL which is working wth the WinCE emulator. However, When i try to use C# (VS.NET) with the C++ dll file, and run it in the WinCE emulator , i have this Exception occur:

An unhandled exception of type 'System.MissingMethodException' occurred

Therefore, please feel free to give me any advice. Thanks!

1) I've been trying to change the DLL. Sine Dumpbin /exports has shown:

1 0 00001050 ??0CTest@@QAE@XZ
2 1 00001000 ??4CTest@@QAEAAV0@ABV0@@Z
3 2 00001040 ?fnTest@@YAHXZ
4 3 00003028 ?nTest@@3HA
so I tried both method to fix it as:

extern "C" int __declspec(dllexport) myIsScanSuspended(void)
{
return IsScanSuspended();
}

or using .DEF file in evc, the dumpbin now looks like:

4 3 00003028 Test
5 4 00001030 myIsScanSuspended

But i still have the same exception ni VS.NET CE

In C#:

using System;
using System.Data;
using System.Runtime.InteropServices;

{

public class CommBase
{
[DllImport("CPP.dll")]
public static extern int myIsScanSuspended();

However, i still have the same exception.
Btw, is that the download problem with the DLL file to the CE emulator? coz i realize that when I build the C# solution, it doesnt upload the (C++) DLL file to the emulator? or do i have to do it seperately?
Or is there anything i miss? thanks for any advice!

Louis
 

THanks all i think i solved the problem!
Louis
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…