dynamic_cast() between a program and a dlopen()ed library

Brian Dessent brian@dessent.net
Fri Nov 14 15:47:00 GMT 2008


edam wrote:

> I was wondering if anyone could shed some light on a problem I'm having.
> I can't seem to get dynamic_cast() to downcast an object returned from a
> library loaded with dlopen(). I was wondering if this is expected
> behaviour or a bug I'm seeing? From what I've read on the web, I think
> it *should* work.

Have a look at <http://gcc.gnu.org/faq.html#dso>.  Your testcase works
for me after adding RTLD_GLOBAL and linking with -Wl,-E.

Brian



More information about the Gcc-help mailing list