This is the mail archive of the
mailing list for the libstdc++ project.
Re: shared libraries & exceptions
- From: Nathan Myers <ncm-nospam at cantrip dot org>
- To: libstdc++ at gcc dot gnu dot org
- Date: Mon, 3 Feb 2003 13:37:37 -0800
- Subject: Re: shared libraries & exceptions
- References: <3E3AFA34.firstname.lastname@example.org> <20030131231151.GN14238@tofu.dreamhost.com> <email@example.com>
On Fri, Jan 31, 2003 at 08:25:59PM -0600, Benjamin Kosnik wrote:
> On Fri, 31 Jan 2003 15:11:51 -0800
> Nathan Myers <firstname.lastname@example.org> wrote:
> >... people often want to call exported C functions in C++ libraries
> >from (what are nominally) C programs. Is there any supported way to
> >explicitly initialize the g++ runtime machinery, in gcc-2 and/or in
> >gcc-3, e.g. by calling some reserved identifier at library-load time?
> >(I wouldn't expect the solution to be the same for gcc-2 and gcc-3.)
> You're a little vague on the exact problem description, or what you are
> trying to do.
I'm talking about plugins written in C++. No sensible person expects
to throw an exception out of a plugin, but everyone who writes a C++
plugin would like to wrap each C entry point in a try block. That
ought to work, except who has initialized the exception machinery to
make it work right? Not _main(), it was never run.
This isn't academic. I'm seeing segfaults during a throw of bad_alloc
in gcc-2.x, and know of no reason to think gcc-3 will necessarily do
So the question is, is there any (non-portable!) entry point that
can be called by the C code, before or after the dlopen, that will
ensure proper initialization of the exception apparatus?