g++, shared/static and exceptions

Lapo Luchini lapo@lapo.it
Mon Jan 13 02:54:00 GMT 2003


Hi.
As I said in other messages I'm "freshening" my C++ skills thanks to a 
university project I must do, guess what, in C++ (I passed from C to 
Java some years ago but now, with STL and exceptions... but that's 
another story).

I'm using gcc 3.2 (but it must work also with 2.95), libexpat, 
libcppunit for "make check" and the full suite of the autotools (which 
is good, as I now know them much better).

I have a small problem though: I recently decided to do things "cleanly" 
and separated my program in a generic library and a set of "example 
programs" that use it.

Two problems here.

The first problem is that the library must be static as libstdc++ isn't 
available as a DLL (that's right? will it be available someday?), but 
this is not a big problem as libtool makes it very easy to use 
"--disable-shared" in the configure.
The real problem is that the exceptions thrown in the library seems to 
always "dump" the program, and can't be catched in the main (which is 
not in the lirary, of course).

I made my good Google search and I found various interesting things on 
the gcc mailing list (and in other places), the main thing being the 
following thread:
http://mail.gnu.org/pipermail/libtool/2002-May/006309.html

That make two more question raise in my head though:
1. it talks about DLL not propagating the exceptions, and I'm using a 
static library.. is a static library net meant for propagating them (so 
that the thread avoid the problem as 'not possible') or the opposite? 
(i.e. they alweays work in static libs)
2. it talks about C++ DLLs... are they possible at all? my libtool 
screams that it cannot create a dynamic library that uses a static 
library... (maybe there is some way to say to it "just include it all"? 
but the, at linking time, wouldn't there be two copies of the stdc++ 
library?)

Thanks for the help ;)

Lapo

-- 
Lapo 'Raist' Luchini
lapo@lapo.it (PGP & X.509 keys available)
http://www.lapo.it (ICQ UIN: 529796)



--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/



More information about the Cygwin mailing list