dynamic_cast between modules
dynamic_cast between modules
- Subject: dynamic_cast between modules
- From: Steve Baxter <email@hidden>
- Date: Thu, 4 Aug 2005 14:09:06 +0100
Hi,
I'm trying to move a large project from Codewarrior to XCode. The
project is broken down into around 50 modules, an application and a
shared framework. The modules and app all link to the framework.
I am having two problems with typeinfo and dynamic_cast:
(1) In Codewarrior it was only necessary to include the header of a
class to be able to use typeinfo or dynaamic_cast on that class. In
XCode I get a link error - "Undefined symbols: typeinfo for xxxx".
This is a pain - there are some circumstances where modules may pass
data to each other through an object database. We use dynamic_cast
to downcast the passed data safely.
(2) I can get around (1) by including the cpp of the object in *both*
modules rather than the "owning" module. This enables the modules to
link, but now the RTTI information doesn't match!
For instance, ModuleA and ModuleB both implement class Y which is a
subclass of X.
ModuleA makes a Y object and puts it in the database.
ModuleB gets the object Y out of the database - the generic interface
returns an X though, so a downcast is needed to cast X to Y.
The dynamic_cast fails - it seems that the object Y created by
ModuleA is not considered to be of the same type as an object Y
created by ModuleB.
This is a bit of a showstopper for us - we rely on shared objects
like this for our database to work!
One solution would be to put the implementations of all shared
objects in the shared framework, however this bloats the shared
framework which we are trying to avoid.
Anyone got any solutions for this? The ideal solution would be a fix
for (1) so that the object code is only in one place.
Cheers,
Steve.
Stephen Baxter
Software Development Manager
Improvision
email@hidden
+44-2476-692229
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden