Re: frameworks, dynamic_cast and gcc 4.0
Re: frameworks, dynamic_cast and gcc 4.0
- Subject: Re: frameworks, dynamic_cast and gcc 4.0
- From: Stephan Huber <email@hidden>
- Date: Tue, 23 Aug 2005 17:50:24 +0200
Hi,
thanks for your reply.
However, in XCode, for shared libraries, the default build settings
are set such that the visibility is "hidden" (private).
I double-checked the settings: "Symbols hidden by default" is off. And I
think I export all the classes correctly.
If you propperly link against the DSO where the class is defined, you
couldn't compile successfully anyway, because you would get link
errors. Just ensure, you *link* against the DSO where the class is
defined - and do *not* include the modul (.cpp) where the class is
defined in the set of source files of the DSO where you perform the
dynamic cast.
Ok, thanks for the clarification -- I am sure, that I link only against
the framework and not against a compiled cpp file.
I create new instances inside the application (DSO 3) and hand them
to DSO 2, which calls a function in DSO 1, which processes my objects
and there the dynamic cast fails inside (DSO 1). The dynamic_cast
does NOT fail in DSO 3.
k,
so firstly, since you create an object in DSO 3, which has base
classes defined in DSO 2, you need to link DSO 3 against DSO 2.
I do this.
Furthermore, you need link DSO 2 against DSO 1, since a class in DSO 2
inherits from a base in DSO 1.
Sorry, there was a misunderstanding: DSO2 does NOT inherits any classes
from DSO1, instead DSO2 calls a subclass (defined in DSO1) of a class
of DSO2. In this subclass inside DSO1 the dynamic_cast fails.
Here's some pseudo-code to explain my settings better:
DSO1 (my framework):
class Pickable {} // abstract class, defined only in the header-file.
class Visitor : public DSO2::Visitor {}
DSO2 (scengraph-framework):
scenegraph-stuff
DSO3 (my app):
class Cube : public DSO1::Pickable, public DSO2::Geode {}
main {
// create some cubes
// attach to scenegraph (DSO2)
// create visitor
// attach to scenegraph (DSO2)
//render-loop, which calls the visitor-subclass
}
So, inside DSO1::Visitor the dynamic_cast fails for DSO1::Pickable.
DSO1 is linked against DSO2, DSO3 is linked against DSO1 and DSO2,
So, what is wrong?
(I can see the subclasses of Cube inside the debugger, even inside the
failing function of DSO1)
Thanks again,
Stephan
_______________________________________________
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