[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: libtool for C++

From: Robert Boehne
Subject: Re: libtool for C++
Date: Mon, 28 Jan 2002 11:20:32 -0600


It is NOT up-to-date for CVS HEAD and alpha versions of Libtool.


"Steve M. Robbins" wrote:
> Hello,
> The libtool manual suggests strongly that one not use it
> for C++ libraries.
> Is this section of the document up-to-date with the stable
> release of libtool?  CVS libtool?
> -------------------- from libtool manual ---------------------
> 11.1 Writing libraries for C++
> Creating libraries of C++ code should be a fairly straightforward
> process, because its object files differ from C ones in only three
> ways:
>   1.Because of name mangling, C++ libraries are only usable by
>     the C++ compiler that created them. This decision was made
>     by the designers of C++ in order to protect users from
>     conflicting implementations of features such as constructors,
>     exception handling, and RTTI.
>   2.On some systems, the C++ compiler must take special actions
>     for the dynamic linker to run dynamic (i.e., run-time)
>     initializers. This means that we should not call `ld' directly to
>     link such libraries, and we should use the C++ compiler
>     instead.
>   3.C++ compilers will link some Standard C++ library in by
>     default, but libtool does not know which are these libraries, so
>     it cannot even run the inter-library dependence analyzer to
>     check how to link it in. Therefore, running `ld' to link a C++
>     program or library is deemed to fail. However, running the
>     C++ compiler directly may lead to problems related with
>     inter-library dependencies.
> The conclusion is that libtool is not ready for general use for C++
> libraries. You should avoid any global or static variable
> initializations that would cause an "initializer element is not
> constant" error if you compiled them with a standard C compiler.
> There are other ways of working around this problem, but they are
> beyond the scope of this manual.
> Furthermore, you'd better find out, at configure time, what are the
> C++ Standard libraries that the C++ compiler will link in by
> default, and explicitly list them in the link command line.
> Hopefully, in the future, libtool will be able to do this job by itself.
> -----------------------------------------------------------------
> From this section, it is unclear whether libtool uses the C++
> compiler or "ld" to do the linking.  If the former, then it sounds
> like the remaining hurdle (from #3) is to discover with which
> standard libraries the compiler is linking.  Is this accurate?
> -Steve
> --
> by Rocket to the Moon,
> by Airplane to the Rocket,
> by Taxi to the Airport,
> by Frontdoor to the Taxi,
> by throwing back the blanket and laying down the legs ...
> - They Might Be Giants
> _______________________________________________
> Libtool mailing list
> address@hidden

Robert Boehne             Software Engineer
Ricardo Software   Chicago Technical Center
TEL: (630)789-0003 x. 238
FAX: (630)789-0127
email:  address@hidden

reply via email to

[Prev in Thread] Current Thread [Next in Thread]