delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2001/05/23/10:24:21

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
content-class: urn:content-classes:message
MIME-Version: 1.0
Subject: RE: exporting symbols from executable and linking shared objects question
X-MimeOLE: Produced By Microsoft Exchange V6.0.4418.65
Date: Wed, 23 May 2001 16:21:59 +0200
Message-ID: <9C8918CC8CDAAC4AA79D4594A480648901E5A07D@EXCHANGE.mmp.plzen-city.cz>
X-MS-Has-Attach:
X-MS-TNEF-Correlator:
Thread-Topic: exporting symbols from executable and linking shared objects question
Thread-Index: AcDjkmF0X9avrt3ESo+gnhSnsz58jwAACQsQ
From: =?iso-8859-2?Q?Hor=E1k_Daniel?= <horak AT sit DOT plzen-city DOT cz>
To: <cygwin AT cygwin DOT com>
X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id KAA01148

> I'm new to the list, but I searched archives looking for a 
> solution and
> found nothing.
> 
> I have TWO questions, but it's the same problem.
> 
> First is -rdynamic swich for gcc. it's used to export symbols 
> for shared
> objects and the second is about linking shared objects (.dll) 
> with symbols
> declared as external.

You can look into a Makefile (src/backend/Makefile) that is used to
create PostgreSQL server executable. It also requires to export symbols
from the main executable to be available for dynamicly loaded modules.

postgres: $(OBJS) $(top_builddir)/src/utils/dllinit.o postgres.def
libpostgres.a
        dlltool --dllname $@$(X) --output-exp $@.exp --def postgres.def
        gcc -g -o $@$(X) -Wl,--base-file,$@.base $@.exp $(OBJS)
$(DLLLIBS)
        dlltool --dllname $@$(X) --base-file $@.base --output-exp $@.exp
--def postgres.def
        gcc -g -o $@$(X) $@.exp $(OBJS) $(DLLLIBS)
        rm $@.exp $@.base

postgres.def: $(OBJS)
        $(DLLTOOL) --export-all --output-def $@ $(OBJS)

libpostgres.a: $(OBJS) $(top_builddir)/src/utils/dllinit.o postgres.def
        $(DLLTOOL) --dllname postgres.exe --def postgres.def
--output-lib $@

It was created a few years ago, so it doesn't use features in recent
compiler/linker. The main trick is to create a DLL with .EXE suffix.

			Dan

--
Want to unsubscribe from this list?
Check out: http://cygwin.com/ml/#unsubscribe-simple

- Raw text -


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