Article View: gnu.g++.help
Article #630How can I build a sharable g++ library?
From: Andreas Zeller
Date: Thu, 17 Dec 1992 21:34
Date: Thu, 17 Dec 1992 21:34
34 lines
1823 bytes
1823 bytes
Hi all,
I'm looking for a way to build a sharable library
using g++ 2.3.2 under SunOS 4.1.1.
The "vanilla" approach (say, g++ -nostdlib -o libstuff.so.1.0 *.o)
does not work, since when I'm linking (using g++ main.o -lstuff),
constructors/destructors of static objects in the sharable library
are not included in the global constructor/destructor list and
thus not invoked upon execution.
There is some code related to this in the 2.0 distribution
of libg++ (drt0.c, init.c, init_main.c, dynamic_lib.c, dldefs.h),
written by James Kempf (of SUN?), but despite all trials,
I can't figure out how to use it correctly.
It seems I have to build a special object, drt0.o
(using gcc -c drt0.c or cc -pic -c drt0.c), which manages all
the constructor/destructor stuff, and have it included in
my shared library. This is what I do. But all I get is
an "illegal instruction" error.
So, if any of you outside there have managed to build a
sharable library using g++, please let me know.
Any hint is appreciated.
Please e-mail. I will summarize your suggestions.
(Andreas Zeller)
--
__o Andreas Zeller
_`\<,_ TU Braunschweig, AG Softwaretechnologie
( )/ ( ) Gaussstrasse 17 Tel: +49 531/391-7580 zeller@ips.cs.tu-bs.de
--^----^-- D-3300 Braunschweig Fax: +49 531/391-8111
Technical Details
Message-ID:
<1992Dec17.223432@ips.cs.tu-bs.de>Path:
arc1-ca.pugleaf.net!sparky!uunet!zaphod.mps.ohio-state.edu!sdd.hp.com!spool.mu.edu!yale.edu!ira.uka.de!Sirius.dfn.de!tubsibr!infbssys!zellerShow Full Headers
Complete Article Headers
Newsgroups: gnu.g++.help Path: arc1-ca.pugleaf.net!sparky!uunet!zaphod.mps.ohio-state.edu!sdd.hp.com!spool.mu.edu!yale.edu!ira.uka.de!Sirius.dfn.de!tubsibr!infbssys!zeller From: zeller@ips.cs.tu-bs.de (Andreas Zeller) Subject: How can I build a sharable g++ library? Message-ID: <1992Dec17.223432@ips.cs.tu-bs.de> Sender: news@ips.cs.tu-bs.de (News Software) Nntp-Posting-Host: infbsst5.ips.cs.tu-bs.de Organization: Inst. f. Informatik, TU Braunschweig, FRG Date: Thu, 17 Dec 1992 21:34:32 GMT Lines: 37