[C++-sig] BPL embedding tutorial updated.

Bjorn Pettersen BPettersen at NAREX.com
Sat Mar 1 19:11:42 CET 2003


> From: Dirk Gerrits [mailto:dirk at gerrits.homeip.net] 
> 
> I've made some changes to my Boost.Python tutorial on embedding.
[...]
> If you find any errors or have any suggestions, I'd love to hear from
you.

Great work! A minor nit though, embedding doesn't require static
libraries (you can even mix and match), static libs does make
distribution easier.

Am I to assume that there will eventually be e.g. (apologies for the
incorrect syntax, I assume you get the idea):

  object py::import::AddModule(std::string const& name);
  dict   py::module::GetDict(object moduleObj);
  object py::RunExpr(std::string const& code, dict globals, dict
locals);
  object py::RunStmt(std::string const& code, dict globals, dict
locals);
  object py::RunStmts(std::string const& code, dict globals, dict
locals);

or is there even thought about wrapping more of the Python object types,
like e.g.:

  module mainModule = py::import::AddModule("__main__");
  dict mainDict = mainModule.getDict();
  interpreter interp(mainDict, mainDict); // globals, locals
  object res = interp.runExpr(std::string const& code);

etc.

Either way would be quite cool IMHO :-)  If you allready have a design
in mind, you should make it available in case someone has time to help
you <wink>.

-- bjorn

  




More information about the Cplusplus-sig mailing list