delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/1997/04/23/16:34:52

From: ebritten AT ea DOT oac DOT uci DOT edu (Eric Britten)
Subject: Building Dlls and exports(gcc & lcc)
23 Apr 1997 16:34:52 -0700 :
Approved: cygnus DOT gnu-win32 AT cygnus DOT com
Distribution: cygnus
Message-ID: <Pine.GSO.3.96.970423121611.28516B-100000.cygnus.gnu-win32@taurus.oac.uci.edu>
Mime-Version: 1.0
Original-To: gnu-win32 AT cygnus DOT com
Original-Sender: owner-gnu-win32 AT cygnus DOT com

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 AT 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 AT 16 and CPlApplet AT 16.  CPlApplet AT 16 worked, there
were no link errors, but now the exported function is CPlApplet AT 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 AT uci DOT edu
-----------------------------------------------

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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019