help-gplusplus
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

dynamic_cast problem


From: Earl Purple
Subject: dynamic_cast problem
Date: 6 Jul 2006 10:22:33 -0700
User-agent: G2/0.2

I think this has been addressed before but not for 2 years.

I have a model whereby I dynamically load libraries with dlopen then
verify that they are the correct types with dynamic_cast.

dynamic_cast seems to be failing though with gcc (I am using 3.2.1
because that is the version we have here that also works with purify).

Whilst I normally don't cast at all in my code, this is the one
occasion I do - I have built this type of model twice before,
successfully using Solaris compiler (which has all sorts of other
problems) and also on VC7 (obviously using LoadLibrary() etc) and it
worked then.

It is vital I use dynamic_cast because reinterpret_cast would of course
lead to undefined behaviour if the type is a mismatch.

And because the name of the symbol to be loaded is read from a
configuration file, there is no possibility of compile-time checks.

Effectively, is it impossible to do object-broking in this manner using
gcc?



reply via email to

[Prev in Thread] Current Thread [Next in Thread]