I need to implement a Win32 DLL and need call it by C# DllImport in WinCE.
So I create a
Win32 Smart Device Project
Windows Mobile 5.0 Smartphone SDK
and create a dll project with Export symbols option.
Then I add
key word before function declare:
#define WINCE2_API __declspec(dllexport)
#define WINCE2_API extern "C" __declspec(dllimport)
extern "C" WINCE2_API int __cdecl Add(int A,int B);
extern "C" WINCE2_API int __cdecl Add(int A,int B)
When I use DllImport in C#:
[DllImport("WinCE2.dll", EntryPoint = "Add")]
static extern int Add(int A, int B);
I always got a System.MissingMethodException in WinCE 5.0 emulator and WinCE6.0 Device.
I searched some information on google, found some solution.
First, Add .def in project:
But in CSDN forum some one say __declspec(dllexport) can replace the .def file.
But this solution also got
Then I found a solution on Stack Overflow:
May I need add
And I created a Win32 DLL Project, I found the project setting will add
But Win32 Smartphone project is not.
So I try it, but also got
Then I try the same code in Win32 DLL and call by C#, it can work.
So I don't know why wince can't work.
Can anyone share me some expeience?