Building Dlls and exports(gcc & lcc)

Eric Britten ebritten@ea.oac.uci.edu
Wed Apr 23 12:34:00 GMT 1997


Recently I tried to build a very simple Control Panel Applet Dll with both
gcc and lcc.

For gcc I use dlltool to create an import library simple.a and an export
file simple.exp

Then when I link using
ld -e _DllEntry@12 -o simple.cpl simple.o simple.exp -subsystem windows
-luser32

I get the error:
simple.exp:  fake: can't find CPlApplet

My simple.def file was
EXPORTS
	CPlApplet

CPlApplet is defined in simple.c as
LRESULT CALLBACK CPlApplet(HWND, UINT, LPARAM, LPARAM)

CPlApplet is the function Windows that calls to run the applet.  It must
be a stdcall function.  So in the def file I changed CPlApplet to
_CPlApplet, _CPlApplet@16 and CPlApplet@16.  CPlApplet@16 worked, there
were no link errors, but now the exported function is CPlApplet@16 instead
of CPlApplet so windows can't find the right function to call to run the
applet.  Although the link worked, when I ran the applet using control
panel, the applet crashed.  I'm not sure why.

Can I export a stdcall function without the _ and @n name mangling?



I also tried the same thing with lcc.
lcc -c simple.c
lcclnk -dll -o simple.cpl -subsystem windows simple.def

I get the error Can't find starting address.

Can anyone help me?

-----------------------------------------------
		Eric Britten
	      ebritten@uci.edu
-----------------------------------------------

-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request@cygnus.com" with one line of text: "help".



More information about the Cygwin mailing list