[C++-sig] Re: exceptions and multiple modules

David Abrahams dave at boost-consulting.com
Wed Jul 23 13:33:07 CEST 2003


"Ralf W. Grosse-Kunstleve" <rwgk at yahoo.com> writes:

> --- greg Landrum <greglandrum at mindspring.com> wrote:
>> At 06:44 PM 7/22/2003, David Abrahams wrote:
>> > > I get the dreaded "RuntimeError: unidentifiable C++ exception"
>> > >
>> > > Any ideas as to what might be going on here?
>> >
>> >Yeah, some.  Could you try the enclosed patch and see whether it
>> >helps?
>> 
>> Yep, that cleared it right up.  Thanks Dave!
>
> Dave, does your trick with the virtual function eliminate the need to use
> RTLD_GLOBAL?

Yes.  Of course, that exception is defined in the library.  If you
want to properly translate a user-defined exception you must either
register the exception translator in the same module which throws it
or you must link the collaborating modules together somehow.  If you
don't like direct linking, you can of course put the exception's
virtual function in some common shared library -- essentially the
trick I just used.

-- 
Dave Abrahams
Boost Consulting
www.boost-consulting.com





More information about the Cplusplus-sig mailing list