g++ / CC compatibility

Alexandre Oliva aoliva@redhat.com
Thu May 17 10:47:00 GMT 2001


On May 16, 2001, Nevenka Bierny <NBierny@quova.com> wrote:

> However, speed is of importance, milliseconds do matter, therefore we would
> rather build a static library which can then be used to build an executable
> using CC or g++.

Since CC is not binary-compatible with g++, even if you manage the
linkage to succeed, you'll still have problems at run-time.  For
example, cout is defined in both CC's and g++'s C++ shared libraries,
and it will be initialized by both, but it's expected to have a
different object layout by each library.  Crashes result.

So, if you're sure you don't use any of the conflicting symbols, you
may go ahead and just link the static libstdc++ and libgcc into the CC
application, *after* its own built-in C++ library.

-- 
Alexandre Oliva   Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer                  aoliva@{cygnus.com, redhat.com}
CS PhD student at IC-Unicamp        oliva@{lsd.ic.unicamp.br, gnu.org}
Free Software Evangelist    *Please* write to mailing lists, not to me



More information about the Gcc-bugs mailing list