Subject: Re: Unwind
To: Thomas Klausner <wiz@NetBSD.org>
From: Nick Hudson <skrll@netbsd.org>
List: tech-toolchain
Date: 01/22/2004 17:24:27
On Thursday 22 January 2004 5:12 pm, Thomas Klausner wrote:
> On Thu, Jan 22, 2004 at 12:17:33PM +1100, matthew green wrote:
> >    
> >    for linking doesn't really seem to apply here -- or should g++ have
> >    been used when creating libsmpeg?
> > 
> > 
> > "g++" (or c++ frontend) should always be used when linking C++ code,
> > whether into a library or an executable.
> 
> Just to make sure:
> When linking a library that was written in C++ against a program
> that was written in C, is gcc/ld enough or should g++ be used too?

The general rule is g++/c++ should be used.

The problem you're hitting could be solved (with my libgcc patches) in a 
couple of ways...

	1) Use gcc/cc -shared-libgcc. c++/g++ adds --shared-libgcc automatically

	2) Link the c++ library with -shared -static-libgcc. This one only works
	   if exceptions only happen within the library.

A C++ library that uses exceptions linked into a c binary is something that 
doesn't work in -current atm.
Nick