From: Scott DOT Mintz AT po DOT cle DOT ab DOT com (Scott Mintz) Subject: Re: Building Dlls and exports(gcc & lcc) 24 Apr 1997 09:16:54 -0700 Approved: cygnus DOT gnu-win32 AT cygnus DOT com Distribution: cygnus Message-ID: <0004B03B.1893.cygnus.gnu-win32@po.cle.ab.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Original-To: gnu-win32 AT cygnus DOT com, Eric Britten Content-Description: cc:Mail note part Original-Sender: owner-gnu-win32 AT cygnus DOT com You can create an alias for the function name using the .def file. The following text is taken from documentation on LINK32. Syntax EXPORTS definitions This statement makes one or more definitions available as exports to other programs. EXPORTS marks the beginning of a list of export definitions. Each definition must be on a separate line. The EXPORTS keyword can be on the same line as the first definition or on a preceding line. The .DEF file can contain one or more EXPORTS statements. The syntax for an export definition is: entryname[=internalname] [@ordinal[NONAME]] [DATA] [PRIVATE] The entryname is the name of the function or data item as it is to be used by the calling program. You can optionally specify the internalname as the function known in the defining program; by default, internalname is the same as entryname. The ordinal specifies an index into the exports table in the range 1 through 65,535; if you do not specify ordinal, LINK assigns one. The NONAME keyword exports the function only as an ordinal, without an entryname. The DATA keyword specifies that the exported item is a data item. The data item in the client program must be declared using extern __declspec(dllimport). The optional keyword PRIVATE tells IMPLIB to ignore the definition. PRIVATE prevents entryname from being placed in the import library. The keyword has no effect on LINK. There are three methods for exporting a definition, listed in recommended order of use: 1. The __declspec(dllexport) keyword in the source code 2. An /EXPORT specification in a LINK command 3. An EXPORTS statement in a .DEF file All three methods can be used in the same program. When LINK builds a program that contains exports, it also creates an import library, unless an .EXP file is used in the build. I hope this helps. +------------------------------+------------------------------------+ | Scott A. Mintz | voice: (216) 646-4805 | | Allen-Bradley Company | fax: (216) 646-4961 | | 1 Allen-Bradley Drive | email: scott DOT mintz AT po DOT cle DOT ab DOT com | | Mayfield Hts., OH 44124-6118 | CIS: 71461,632 | +------------------------------+------------------------------------+ ______________________________ Reply Separator _________________________________ Subject: Building Dlls and exports(gcc & lcc) Author: Eric Britten at Internet Date: 4/23/97 12:34 PM 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". - 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".