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

Roman Sulzhyk roman_sulzhyk at yahoo.com
Wed Jun 18 17:57:00 CEST 2003


Ooops, never mind guys, I thought it was the dangling pointer in the
casting of the Python class to base C++ class, but I've just realized
it was actually complaining about the next line, when it returns the
char * as the result of the testme() call, so I'm past the problem bit
and I'll be able to deal with it now.

Thanks, sorry...

Roman

--- Roman Sulzhyk <roman_sulzhyk at yahoo.com> wrote:
> Guys:
> 
> 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
> Aborted
> 
> 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!
> 
> Roman
> 
> __________________________________
> Do you Yahoo!?
> SBC Yahoo! DSL - Now only $29.95 per month!
> http://sbc.yahoo.com

> ATTACHMENT part 2 application/octet-stream name=smallexample.cpp



__________________________________
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!
http://sbc.yahoo.com




More information about the Cplusplus-sig mailing list