[Top][All Lists]

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

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

From: Patrick Welche
Subject: Re: C linkage problem when C++ library is used.
Date: Thu, 15 Apr 2004 21:00:10 +0100
User-agent: Mutt/

On Fri, Apr 16, 2004 at 02:21:11PM -0500, 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 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.

Imagine the scenario in which a software package may optionally
depend on libraries to extend its capabilities. Everyone is merrily
using the C compiler, until the day it turns out that one of those
optional libraries is written in C++, then everything suddenly must
be linked with C++? Is it a goal for libtool to be able to
scrape together object files compiled from multiple languages together
into one executable? (--tag=FORTRAN -lfortlib --tag=C++ -lsomecxxlib ?)



reply via email to

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