[C++-sig] Getting base C++ class from a derived python class...

Roman Sulzhyk roman_sulzhyk at yahoo.com
Wed Jun 18 17:22:26 CEST 2003


Sorry to bother this forum, but I've been stuck at this for two days
now and can't seem to make any progress. I'm basically trying to follow
the example in tests/embedding.cpp, which works just fine for me, but
my little program fails with dangling pointer error!

[roman at mholden ~/src/pysymphony]$ ./smallexample
returning service...
Casting the service...
Some exception caught!
ReferenceError: Attempt to return dangling pointer to object of type: c

I'm using pyste to generate wrapper code, for the example purposes I've
piled it all in one file. Also, it didn't look as ugly to begin with, I
hacked it to make it closer to the embedding example and yet it still
doesn't work.

One thing I can see different is that pyste generated code produces

 class_< PyService, boost::noncopyable, PyService_Wrapper
>("PyService", init<  >())

whereas in the embedding example it's more like

class_< PyService, PyService_Wrapper, boost::noncopyable>("PyService",
init<  >())

however moving things around didn't seem to help :)

Any insight would be greatly appreciated!


Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smallexample.cpp
Type: application/octet-stream
Size: 3257 bytes
Desc: smallexample.cpp
URL: <http://mail.python.org/pipermail/cplusplus-sig/attachments/20030618/9ce0ead1/attachment.obj>

More information about the Cplusplus-sig mailing list