[C++-sig] Extending Python with not-basic-c++

Stefan Seefeld seefeld at sympatico.ca
Thu Nov 30 21:17:30 CET 2006


David Sveningsson wrote:
> Stefan Seefeld skrev:
>> David Sveningsson wrote:
>>   
>>> Hi, I have a working C++ game. To make it easier to
>>> extend/control/whatever some kind of scripting support is required. I
>>> know Python isn't really a scripting language but it seems like the best
>>> choice. I should also note that my knowledge of python is very limited.
>>>
>>> I heard that embedding python isn't a good way so I'm about to extend
>>>     
>> Why not ?
>>   
> What I heard was that python was not designed for this and thus the
> python C API isn' the best. Are you suggesting I should embedd instead?

I'm not sure what it originally was designed for, but I can assure you
that it works great as an embedded scripting environment. I'm not
qualified to tell you the best strategy, as I don't know the context.

In any case, it's not 'instead', as in order to script your application
'from within', you need to expose your API to some degree to the script's
environment, anyhow.

>>> When compiling a class module for python it says undefined symbol 'a
>>> class method here'. So I include that class-objectfile when I compile
>>> the module. Eventfully it works but I cant do like this.
>>>     
>> You really ought to provide some more detail here if you expect anybody
>> to be able to help. Some code snippets, together with the actual error
>> message from your compiler
> As I said, it works but for each module I have to link against many of
> my c++ object files. So the same files is linked into many modules. What
> I mant to know if this is the way it has to be done or if there is a
> better way. Won't it be problematic if each module has it's own version
> of everything?

Don't you use shared libraries ? Sharing doesn't imply duplication.

HTH,
		Stefan

-- 

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



More information about the Cplusplus-sig mailing list