Any other ideas?
From: Eljay Love-Jensen <eljay@xxxxxxxxx>
To: "Yuly Novikov" <novikov_yuly@xxxxxxxxxxx>, gcc@xxxxxxxxxxx, gcc-help@xxxxxxxxxxx
CC: novikov_yuly@xxxxxxxxxxx
Subject: Re: Need help with dynamic_cast across shared libraries with gcc 3.2.3.
Date: Thu, 17 Jul 2003 09:43:21 -0500
Hi Yuly,
>Is there any other way to make the algorithm above work with gcc 3.2.3?
If you KNOW the pointer is the given type, use a reinterpret_cast<foo*>(ptr) instead of a dynamic_cast<foo*>(ptr). And put a BIG disclaimer in your source code saying "This is correct. All your {derived class pointer name} are belong to us."
Also note: if you use those kinds of objects for exceptions in your across-shared-library boundaries, you'll probably run into situations where your code fails to catch the object. The dynamic_cast mechanism uses the same RTTI information that the exception handling's catch mechanism uses. And, similiarly, you'll probably experience problems using the RTTI mechanism if you use typeid and type_info.
HTH, --Eljay
PS: you shouldn't need to dynamic_cast the derived pointer to the base pointer type. A derived pointer IS-A base pointer, already.
_________________________________________________________________
Help STOP SPAM with the new MSN 8 and get 2 months FREE* http://join.msn.com/?page=features/junkmail