|
From: Martin C. <ca...@cs...> - 2007-10-19 21:01:34
|
I'm sure this question comes up periodically, but I've been unable to find a suitable answer in the archives. Is it possible to pass swig-wrapped objects created in C/C++ to python? As far as I can tell, swig's *_wrap.cxx keeps things local so called the _wrap_new* methods by hands doesn't return what one would expect. As a temporary solution, I've hacked together an abomination where I grab my module from python, call the constructor function, then pull the "this" attribute from the returned proxy, cast that to a PySwigObject and finally grab the pointer ... (uggh). What I would like to do instead is ... myclass* myobj = new myclass(); PyObject* newarg = __fancy_method_to_create_swig_wrapped_pyobject(myobj); Any thoughts would be greatly appreciated. many thanks, Martin |