From: Alexandre Naaman (naaman++at++laplace.engr.sgi.com)
Date: 02/04/2003 13:32:35
On Tue, 4 Feb 2003, Steffen wrote:
Hi Steffen,
Well, it looks like this has something to do with the /GR- switch used by
default by Microsoft's C++ compiler. This switch turns off dynamic casting
and you've got to re-enable it with the /GR compile flag.
But herein lies the problem. It doesn't sound like it's advisable to mix
and match programs/libraries which have been compiled with and without
this switch. Performer wasn't compiled with the /GR switch so ... we would
have to recompile the library with this enabled and see what happens (I'll
do that tonight just for fun.)
Writing a sample program with a tiny DLL that checks to see if a library
that is not compiled with the /GR flag doesn't show the problem we're
seeing here. But then libpf is a slightly larger beast than the little
sample code I wrote. So, I'll test it and then we can move on from there.
(and let's hope that there aren't isn't a performance hit for using this
stuff.)
One final note of interest, you can also enable RTTI by using the
preprocessor flag _CPPRTTI in lieu of the compile flag.
Thanks for the feedback, expect some news about this sometime soon
(tomorrow).
Alex.
> Since pfNode is polymorph
> virtual ~pfNode();
> and pfDCS inherits from it via pfSCS and pfGroup,
> I do not understand the following crash using dynamic_cast for safety:
> (pfNode* ch; inserted to find the crash)
>
> pfNode* gExt = pfdLoadFile("any.flt");
> if (gExt) {
> //make instance
> pfGroup* inst = new pfGroup;
> pfDCS* d = new pfDCS;
> inst->addChild(d);
> d->addChild(gExt);
>
> //clone 'inst' and move
> unsigned int n = 100;
> std::vector<pfGroup*> g(n, (pfGroup*)(0));
> for (unsigned int i=0; i<n; i++) {
> g[i] = (pfGroup*)inst->clone(0);
> pfNode* ch = g[i]->getChild(0);
>
> pfDCS* d = (pfDCS*)(ch); //works
> // d = dynamic_cast<pfDCS*>(ch); //crashes!
>
> if (d) d->setTrans(4, 3*i, 0);
> m_pGTerrain->addChild(g[i]);
> }
> }
>
> Any hint?
> I'm using MSVC++ 6 and RTTI is on - works with other classes.
>
> Steffen
>
> -----------------------------------------------------------------------
> List Archives, Info, FAQ: http://www.sgi.com/software/performer/
> Open Development Project: http://oss.sgi.com/projects/performer/
> Submissions: info-performer++at++sgi.com
> Admin. requests: info-performer-request++at++sgi.com
> -----------------------------------------------------------------------
>
This archive was generated by hypermail 2b29 : Tue Feb 04 2003 - 13:32:42 PST