[C++-sig] python extended object to native c++ pointer (original) (raw)

Stefan Seefeld seefeld at sympatico.ca
Mon Aug 31 14:34:38 CEST 2009


On 08/31/2009 07:51 AM, Mark Chandler wrote:

Im toying around with the idea to use python as an embedded scripting language for a project im working on and have got most things working. However i cant seem to be able to convert a python extended object back into a native c++ pointer.

[...]

import GEGameMode def Ident(): return "Alpha" def NewGamePlay(): return "NewAlpha" def NewAlpha(): import GEGameMode import GEUtil class Alpha(GEGameMode.CGEPYGameMode): def init(self): print "Made new Alpha!"

          super(Alpha, self).__init__()

is missing here.

def FunctionCall(self): GEUtil.Msg("This is function test Alpha!") def StringReturn(self): return "This is return test Alpha!" return Alpha()

Without explicit initialization of the base class, your Alpha instance is in fact not a CGEPYGameMode instance.

HTH, Stefan

--

   ...ich hab' noch einen Koffer in Berlin...


More information about the Cplusplus-sig mailing list