Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 21 May 2003 10:00:06 -0400 (EDT)
From:      Keith Bostic <bostic@abyssinian.sleepycat.com>
To:        gerald@FreeBSD.org
Cc:        freebsd-bugs@FreeBSD.org
Subject:   Re: gnu/13525: gcc fails load against library with both C++ and C modules
Message-ID:  <200305211400.h4LE06nx008396@abyssinian.sleepycat.com>

next in thread | raw e-mail | index | archive | help
> Synopsis: gcc fails load against library with both C++ and C modules
>
> State-Changed-From-To: feedback->closed
> State-Changed-By: gerald
> State-Changed-When: Wed May 21 06:41:18 PDT 2003
> State-Changed-Why: 
> I debugged this in further depth, and it is apparently operator error: As
> soon as you use any C++ library routines (whether directly or indirectly)
> you need to link the final binary using g++, not gcc, and the g++ driver
> then will link any additional libraries required.

I said in the bug report that you could build, if you built with
g++, not gcc.

> The following would have worked for the example provided:
>   gcc -Wall -c -fpic a.c
>   c++ -Wall -c -fpic b.cc
>   gcc -shared -o libab.so a.o b.o
>   gcc -Wall -c c.c
>   c++ -o c c.o ./libab.so

Your analysis misses the point I tried to make -- if you write
a C program, which only uses C library modules, why should a C++
compiler be needed?

Neither the C code you wrote, nor the C library modules you
loaded, should have "used any C++ library routines (directly or
indirectly)" -- why does the act of loading against a library
that contains both C and C++ modules, suddenly require use of
a C++ compiler?

There shouldn't be any "additional libraries" required -- it's
a program written entirely in C, it never loaded a C++ anything,
why would there be any need for additional C++ libraries!?

I mean, it's probably that there's something that's getting
magically loaded out of the library, just because it exists
in the library, but my point is there's no reason for that
to happen that I can think of.

Regards,
--keith

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Keith Bostic			bostic@sleepycat.com
Sleepycat Software Inc.		keithbosticim (ymsgid)
118 Tower Rd.			+1-781-259-3139
Lincoln, MA 01773		http://www.sleepycat.com



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200305211400.h4LE06nx008396>