how to write a simple DLL using eVC++ 4.0

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,

I am a beginner in writing DLLs for WinCE.

Could you please let me know the stepwise procedure for writing
a simple DLL, for example with one method, using 'C' language and
eMbedded Visual C++ 4.0. so that I can understand the process.

Cheers,

Naveen.
 
you can see the sample application on your PC which comes along with the
SDK's

path might be similar to this

C:\Program Files\Windows CE Tools\wce420\POCKET PC
2003\Samples\Win32\Memwatcher

--
Thanks,

Arvind

--
"eRiva Systems" - Where Technology Meets Life, Every Minute.

(e-mail address removed)

www.erivasystems.com
 
Hi,

Thanks for the response.


I have created the my sample dll in following way but I couldn't add
this new sample dll to my C# project..


1. opened eVC4, file|new|WCE Dynamic-Link Library

2. selected "An empty Windows CE DLL"

3. added "mydll.c" file to source files and added following code
#include<windows.h>
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include"mydll.h"

void hello()
{
printf("Hello DLL World\n");
}

4. then added "mydll.h" and added

ifdef __cplusplus
#define cppfudge "C"
#else
#define cppfudge
#endif

#ifdef BUILD_DLL
// the dll exports
#define EXPORT __declspec(dllexport)
#else
// the exe imports
#define EXPORT extern cppfudge __declspec(dllimport)
#endif

__declspec(dllexport) void hello();


5. Then add mydll.def file and added

LIBRARY mydll

EXPORTS
hello

then I compiled and built it. It's fine and compiled properly.

But when I added this "mydll.dll" to my C# smart device applications
it was complaining that this is not an .NET assembly. what was wrong.

Now, is my process is correct? or did I forget anything?

is there any better process of writing DLLs using 'C' and eVC4.

please let me know.

Cheers,

Naveen.
 
You can't add a native dll to a managed code project. You can call into
exposed functions using Platform Invoke, but you don't add a reference to
the dll to achieve this.
See here for an intro to P/Invoke:-
http://www.codeproject.com/netcf/compframe1.asp

Peter

--
Peter Foot
Windows Embedded MVP
www.inthehand.com | www.opennetcf.org

Do have an opinion on the effectiveness of Microsoft Windows Mobile and
Embedded newsgroups? Let us know!
https://www.windowsembeddedeval.com/community/newsgroups
 
Hi Peter,

Thanks for the response.

I'm wondering my process of DLL creation, that I have
mentioned in my previous post, is correct or not.
If there is any better way kindly let me know.

Cheers,

Naveen.
 
Hi,

One more thing. When test my sample DLL by some reason
I am getting "MissingMethodException".

I have checked the exported methods name using "depends" tool.
I'm using the correct names.

Do you think my test dll hasn't been deployed either on emulator or on my
PDA.
If that could be the case,
How can I put my test dll in
1. Emulator
2. PDA (in my case it is HP iPAQ h5550)

Cheers,

Naveen.
 
Back
Top