delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2000/10/09/08:53:23

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
From: "=?iso-8859-1?Q?J=FCrgen_Schuck?=" <Juergen DOT Schuck AT materna DOT de>
To: "michal karczmarek" <michal AT karczma DOT net>, <cygwin AT sourceware DOT cygnus DOT com>
Subject: AW: Linking Dynamic Libraries
Date: Mon, 9 Oct 2000 14:54:29 +0200
Message-ID: <004501c031f0$10478ad0$0d33028b@zapperlot.materna.de>
MIME-Version: 1.0
X-Encoded: Changed encoding from 8bit for 7bit transmission
X-Priority: 3 (Normal)
X-MSMail-Priority: Normal
X-Mailer: Microsoft Outlook 8.5, Build 4.71.2173.0
Importance: Normal
X-MimeOLE: Produced By Microsoft MimeOLE V4.72.2106.4
In-Reply-To: <20001006194401.14378.cpmta@c004.sfo.cp.net>
X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id IAA29142

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

- Raw text -


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