libtool
[Top][All Lists]
Advanced

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

Re: C linkage problem when C++ library is used.


From: Bob Friesenhahn
Subject: Re: C linkage problem when C++ library is used.
Date: Thu, 15 Apr 2004 14:43:57 -0500 (CDT)

On Fri, 16 Apr 2004, Albert Chin wrote:

> On Thu, Apr 15, 2004 at 11:10:20AM -0500, Bob Friesenhahn wrote:
> > If a program which is based on C language depends on a library which
> > is implemented in C++, the C++ compiler should be used to link the
> > program.  Otherwise C++ static initialization may not work right, or
> > linking may fail entirely.  Libtool doesn't currently offer any
> > provision to do that.
> >
> > The installed .la file for a C++ library does not indicate the
> > implementation language, or what linker should be used.  When the C++
> > library was built using modern GCC then libstdc++.la is listed as a
> > library dependency so at some clue may be gleaned from that fact.
> >
> > It seems to me that this is a fundamental flaw in muti-lingual libtool
> > as it exists today.
>
> Shouldn't the developer be responsible for using the C++ compiler
> rather than the C compiler? Why should libtool solve this? Without
> libtool, the developer should be using the C++ compiler to link
> anyway.

The "developer" is not necessarily aware of all the library
dependencies since she may not be responsible for the maintenance of
these libraries, or how they are configured.  Perhaps in some cases a
C-based widget library is used, while in other cases a C++-based
widget library is used.  Another unfortunate issue is that when the
developer provides a .c file to Automake, Automake will automatically
apply the rules necessary to compile and link a C source file.
However, if a C++ library is used which was built using libtool, then
libtool should be aware that C++ is now in the picture and thus C++
linkage is needed.

Without this support in libtool, whether an application links, or
successfully runs after linking is platform dependent.

Bob
======================================
Bob Friesenhahn
address@hidden
http://www.simplesystems.org/users/bfriesen





reply via email to

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