[Top][All Lists]

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

Re: linking against c++ shared library built using autoconf (and libtool

From: Ludovic Courtès
Subject: Re: linking against c++ shared library built using autoconf (and libtool)
Date: Thu, 15 Jul 2004 15:14:47 +0200
User-agent: Mutt/1.5.4i [Guile enabled]

Today, 12 minutes, 50 seconds ago, Ralf Corsepius wrote:
> This way you compile your whole program using the C++ compiler, i.e. you
> actually are compiling it as a C++ program, not as a c-program.

Right.  But it doesn't hurt much (wrt. mangled symbol names, for
instance) so long as you are compiling a program, not a library.


> This only works with some (old) versions of gcc for some selected
> targets (eg. gcc-2.9x on i386). In general (esp. with gcc >= 3.0), it
> does not work.

G++ 3.0.2 on i386 has `libstdc++' too.  From my understanding of (especially 5.2),
`libstdc++' won't disappear from G++.  Were you talking about `libg++'?

> >  but other C++
> > environments do not necessarily have `libstdc++').  In order to link
> > against a C++ library without having a C++ compiler, one needs to have
> > `libstdc++' (or equivalent) statically linked into the C++ library.
> Sorry, this is not true.
> With g++, in general, you have to use "g++" to link and must not
> explicitly add "-lstdc++". Admitted, there exist some occasions for some
> apps/libs on some architectures for some versions of gcc where the trick
> you describe sometimes work, but in general, this does not work.

Yes, that's what I meant.  However, one has to consider that the user
linking against your library doesn't necessarily have a C++ compiler and
runtime environment (think of a library implemented in C++ which
provides a plain C API).  How would you accommodate such a situation if
not by linking the C++ lib against libstdc++.a or equivalent?


reply via email to

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