[C++-sig] instantiate python classes in c++

Gregor Burger gregor.burger at uibk.ac.at
Sat Apr 4 11:23:55 CEST 2009


On Fri, Apr 3, 2009 at 4:40 PM, Gennadiy Rozental <rogeeff at gmail.com> wrote:

> Gregor Burger <Gregor.Burger <at> uibk.ac.at> writes:
>
> > is it possible to use boost.python to define classes
> > in a script (like in the one below), register the defined
> > classes and later on create instances of the class?
>
> Yes

thank god! ;-)

>
>
> > Is it possible to provide the same globals and locals to call_method
> > so that Flow and other classes are defined?
>
> No. You can't "update" global dictionary at the call point.
>
> This is the issue I am very much familiar with. You can find 2 posts from
> me
> with pretty much the same content.

Maybe you can point me to the posts. I found you questions but not the
answer including the solution.

>
>
> The only viable solution I found is to *compile* the script first before
> executing it. If I do this global dictionary is bound to the class methods
> and
> you code will work fine.
>
> Gennadiy
>
> _______________________________________________
> Cplusplus-sig mailing list
> Cplusplus-sig at python.org
> http://mail.python.org/mailman/listinfo/cplusplus-sig
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/cplusplus-sig/attachments/20090404/c212a33b/attachment.htm>


More information about the Cplusplus-sig mailing list