[C++-sig] A question about PyImport_AppendInittab
Qun Cao
quncao at alumni.usc.edu
Sat Aug 26 02:42:18 CEST 2006
Hi Everyone,
I am adopting the code in boost/libs/python/test/embedding.cpp for my
project. Here is my question, in
embedding.cpp we have:
if (PyImport_AppendInittab("embedded_hello", initembedded_hello) == -1)
throw std::runtime_error("Failed to add embedded_hello to the
interpreter's "
"builtin modules");
I noticed #define BOOST_PYTHON_MODULE BOOST_PYTHON_MODULE_INIT in
module.hpp file, so I guess "initembedded_hello" here is a pointer to
the module "embedd_hello". However, in my project,
BOOST_PYTHON_MODULE{} definition code sits
in a different class class_wrapper.cpp than main.cpp, does that mean i
need to include class_wrapper.cpp in main.cpp? That gives me wierd
problem in compilation though.
Also, generally, why main.cpp needs to know how a C++ wrapper module
is created? Isn't it enough to tell it that there exists a python
module in class.dll and the embedded python interpreter will just
understand everything from there?
Thanks for any insights,
Qun
More information about the Cplusplus-sig
mailing list