delorie.com/archives/browse.cgi | search |
Mailing-List: | contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm |
List-Subscribe: | <mailto:cygwin-subscribe AT sources DOT redhat DOT com> |
List-Archive: | <http://sources.redhat.com/ml/cygwin/> |
List-Post: | <mailto:cygwin AT sources DOT redhat DOT com> |
List-Help: | <mailto:cygwin-help AT sources DOT redhat DOT com>, <http://sources.redhat.com/ml/#faqs> |
Sender: | cygwin-owner AT sources DOT redhat DOT com |
Delivered-To: | mailing list cygwin AT sources DOT redhat DOT com |
Message-ID: | <39E1CC08.F475851F@ece.gatech.edu> |
Date: | Mon, 09 Oct 2000 09:45:44 -0400 |
From: | "Charles S. Wilson" <cwilson AT ece DOT gatech DOT edu> |
X-Mailer: | Mozilla 4.75 [en] (WinNT; U) |
X-Accept-Language: | en |
MIME-Version: | 1.0 |
To: | =?iso-8859-1?Q?J=FCrgen?= Schuck <Juergen DOT Schuck AT materna DOT de> |
CC: | michal karczmarek <michal AT karczma DOT net>, cygwin AT sourceware DOT cygnus DOT com |
Subject: | Re: AW: Linking Dynamic Libraries |
References: | <004501c031f0$10478ad0$0d33028b AT zapperlot DOT materna DOT de> |
There's an easier way -- one command! 'gcc -shared' will create a dll for you. Just do: $(BASE)=foo gcc -shared -o cyg$(BASE).dll -Wl,--out-implib=lib$(BASE).dll.a \ -Wl,--export-all -Wl,--enable-auto-image-base \ -Wl,--output-def=cyg$(BASE).def $(OBJS) Grab any of the packages in the 'contrib' directory and look an the makefiles (you might need to do a minimal 'configure' first, to customize the Makefile for cygwin before using it as a model) --Chuck Jürgen Schuck wrote: > > I'm not sure about the kind of object that 'gcc -shared' > produces. But I think it won't be what you might expect. > In Windows shared sobjects are DLL's. You probably will > have to convert your Makefiles to cproduce DLL's instead > of UNIX-style .so files. > > I did the same task when porting a TCL-extension from > UNIX to Cygwin. The Makefile (SVR4) changes from > > libTclDM20.so: > ld -G -o $@ $(OBJS) > > to > > LOAD = TclDM20 > DEF = $(LOAD).def > BAS = $(LOAD).base > EXP = $(LOAD).exp > $(DLL): $(OBJS) > echo EXPORTS >$(DEF) > nm $+ | grep '^........ [T] _' | sed 's/[^_]*_//' >>$(DEF) > $(LD) --base-file $(BAS) -dll -o $@ $+ -e _dll_entry AT 12 \ > -L`dirname \`gcc -print-file-name=libgcc.a\`` \ > $(LIBS) -lgcc -lcygwin -lkernel32 -lgcc > dlltool --as=as -dllname $@ --def $(DEF) \ > --base-file $(BAS) --output-exp $(EXP) > $(LD) --base-file $(BAS) $(EXP) -dll -o $@ $+ -e _dll_entry AT 12 \ > -L`dirname \`gcc -print-file-name=libgcc.a\`` \ > $(LIBS) -lgcc -lcygwin -lkernel32 -lgcc > dlltool --as=as -dllname $@ --def $(DEF) \ > --base-file $(BAS) --output-exp $(EXP) > $(LD) $(EXP) -dll -o $@ $+ -e _dll_entry AT 12 \ > -L`dirname \`gcc -print-file-name=libgcc.a\`` \ > $(LIBS) -lgcc -lcygwin -lkernel32 -lgcc > > For further information see > http://sources.redhat.com/cygwin/docs.html, > section "Writing DLLs". Reading these docs you > will find two further modules: dll_init.c and > dll_fixup.c. I didn't put them into my DLL because > the resulting DLL crashes the TCL-interpreter. > > Furthermore I found it very helpful to take a > look into the Makefiles of the DLL-generating > packages of the Cygwin-distribution: tcl, wish > and tix. > > Jürgen Schuck > PCM-Kundenbetreuung > Business Unit Information > _________________________________________________ > MATERNA GmbH Information & Communications > Vosskuhle 37 * 44141 Dortmund > Tel.: 0231 - 5599 - 191 * Fax: -272 > Handy: 0172 - 23 70 148 * http://www.materna.de > > -- > Want to unsubscribe from this list? > Send a message to cygwin-unsubscribe AT sourceware DOT cygnus DOT com -- Want to unsubscribe from this list? Send a message to cygwin-unsubscribe AT sourceware DOT cygnus DOT com
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |