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

Re: [Offtopic] C++-coded-packages



On 28 Aug 1997, Guy Maor wrote:

> Jason Gunthorpe <jgg@gpu.srv.ualberta.ca> writes:
> 
> > That reminds me, why do a number of programs use libg++ when they never
> > call any of the special GNU C++ functions?
> 
> g++ links in libg++ and stdc++ by default.  Link with gcc to prevent
> this.

I suppose I should restate the question to what I was really thinking,
why does the linker link to shared libraries that are not used in any way
in the code?

If I can compile code with gcc and the proper -L lines, shouldn't the
linker be smart enough to remove unneeded files?

Look at your example below, g++ included libm and libg++, neither of them
are used.

Jason

> $ cat a.cc
> #include <iostream.h>
> int main() { cout << "hello, world\n"; }
> $ g++ -c a.cc
> $ g++ a.o
> $ ldd a.out
>         libg++.so.272 => /usr/lib/libg++-dbg/libg++.so.272 (0x4000e000)
>         libstdc++.so.272 => /usr/lib/libg++-dbg/libstdc++.so.272 (0x40047000)
>         libm.so.6 => /lib/libm.so.6 (0x4007e000)
>         libc.so.6 => /lib/libc.so.6 (0x40097000)
>         /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x40000000)
> $ ./a.out
> hello, world
> $ gcc a.o -lstdc++
> $ ldd a.out
>         libstdc++.so.272 => /usr/lib/libg++-dbg/libstdc++.so.272 (0x4000e000)
>         libc.so.6 => /lib/libc.so.6 (0x40045000)
>         /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x40000000)
> $ ./a.out
> hello, world


--
TO UNSUBSCRIBE FROM THIS MAILING LIST: e-mail the word "unsubscribe" to
debian-devel-request@lists.debian.org . 
Trouble?  e-mail to templin@bucknell.edu .


Reply to: