Is there a way to transfer a new class instance (python class that inherits c++ class) into c++ with out having to hold on to the object return and just treat it as a c++ pointer.
For example:
C++
object pyInstance = GetLocalDict()["makeNewGamePlay"]();
CGEPYGameMode* m_pGameMode = extract< CGEPYGameMode* >( pyInstance );
pyth:
class Alpha(CGEPYGameMode):
def someFunct(self):
pass
def makeNewGamePlay():
return Alpha()
pyInstance is the python class instance and m_pGameMode is a pointer to the c++ baseclass of the same instance. However if i store the pointer and let the object go out of scope, the python object is cleaned up. Is there any way to only have the c++ pointer with out the object getting cleaned up?
More info: http://stackoverflow.com/questions/1355187/python-object-to-native-c-pointer