On 04/27/2012 08:07 AM, Yoann Chaumy wrote:
>
> so, what should I do in the main to send an instance Personage to the
> script Python ?

Something like the following (assumes the Python interpreter is already
properly initialized):


void call_script(std::string const &script, Personage &p)
{
  namespace bpl = boost::python;
  bpl::dict global;
  global["personage"] = p; // inject 'p' into script's environment
  bpl::exec_file(script.c_str(), global); // run it
}


HTH,
        Stefan


-- 

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

_______________________________________________
Cplusplus-sig mailing list
Cplusplus-sig@python.org
http://mail.python.org/mailman/listinfo/cplusplus-sig

Reply via email to