[C++-sig] Lost Again! :)

Nicolas Tessore wz_ at gmx.net
Thu Aug 31 20:13:03 CEST 2006


Roman Yakovenko wrote:
> Please read these tutorials:
> http://language-binding.net/pyplusplus/documentation/tutorials/module_builder/module_builder.html

I did, though I fear I am too underexperienced to see any direct 
connection to my problem. Or did I misspell my problem? The situation is 
the following:

I have a base class MyClass. From it, I derive HisClass and HerClass.
Then I have a function
   DynamicCast<T>(MyClass *)
and another one called(MyClass *)
   StaticCast<T>
which are used to cast one of MyClass's derivatives into another, ie.

   HisClass h1;
   HerClass h2;
   h2 = DynamicCast<HisClass>(h2);

Now sorry if I am turning around here, and you answered this already. If 
so, please tell me and I will stop asking until I get the knack myself. :)

I then used a helper to write my special Py++ header:

   01:  /* The cast object */
   02:  MyClass *CastObj;
   03:
   04:  /* Cast every object once to make it known to Py++ */
   05:  DynamicCast<HisClass>(CastObj);
   06:  DynamicCast<HerClass>(CastObj);
   07:  ...

This produces a result in my binding source file. I understood I then 
have to rename the functions, but is there a way to do this in a 
pattern-like way so I can rename all DynamicCast<T> to DynamicCastToT in 
one step? Though I just checked that using a loop for renaming them 
"manually" should work as well.

> I am not sure that this is your mistake. Can you create small script that
> reproduce the error?

Unfortunately, I cannot. It does not happen on smaller test projects, 
and only occasionally on the library now.

> You don't read Py++ warnings, right?

I try to, but it is a bit hard to spot this one in 11237 lines of 
output. Especially if you are unsure what to look for.

Still I am happy to get more and more functionality to work :)

Best regards,

N.



More information about the Cplusplus-sig mailing list