Subject: Building Dlls and exports(gcc & lcc)
From: [email-masked] (Eric Britten)

23 Apr 1997 16:34:52 -0700
Approved: [email-masked]
Distribution: cygnus
Message-ID: <[email-masked]>
Mime-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII
Original-To: [email-masked]
Original-Sender: [email-masked]

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
	      [email-masked]
-----------------------------------------------

-
For help on using this list (especially unsubscribing), send a message to
"[email-masked]" with one line of text: "help".