Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 17 Apr 1996 11:28:50 -0700 (PDT)
From:      John Polstra <jdp@polstra.com>
To:        ejs@bfd.com
Cc:        freebsd-hackers@freebsd.org
Subject:   Re: How to make g++ shared libraries?
Message-ID:  <199604171828.LAA17682@austin.polstra.com>
In-Reply-To: <Pine.BSF.3.91.960417081909.10222A-100000@harlie.bfd.com>

next in thread | previous in thread | raw e-mail | index | archive | help
In article <Pine.BSF.3.91.960417081909.10222A-100000@harlie.bfd.com>
ejs@bfd.com writes:
> 
> I'm trying to create a shared version of the Cvo (Cray Visual Objects) 
> c++ library, but it isn't working.  I followed the same steps that I do 
> to make regular c shared libraries (gcc with -c and -fpic, then 
> ld -Bshareable to create the libCvo.so.1.0.  This creates a library that 
> I can link against, but when I try to execute the resulting program, I 
> get:
> 
> Cvo-24: Global constructors were probably not called.

You must include "/usr/lib/c++rt0.o" near the front of your "ld" command
line when creating C++ shared libraries.  E.g.,

    ld -Bshareable -o libfoo.so.1.0 /usr/lib/c++rt0.o *.o

If you are using the standard FreeBSD makefiles (<bsd.lib.mk>), you can
accomplish this by defining the CPLUSPLUSLIB make variable.
-- 
   John Polstra                                       jdp@polstra.com
   John D. Polstra & Co., Inc.                Seattle, Washington USA
   "Self-knowledge is always bad news."                 -- John Barth



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199604171828.LAA17682>