Hi, I am quite new at extending python with c++. I am using the boost libraries on gnu/linux. I have many classes (with inheritance) that I would like to expose to python. Is there some way to have many python modules in one file? Like, core.so contains a string class and a memory class. I tried just compiling everything as a shared library and importing into python with "import core.string" but then I get the error "ImportError: dynamic module does not define init function (initcore)" Im not really sure what that means.
On 11/28/06, David Sveningsson <ext@sidvind.com> wrote:
Hi, I am quite new at extending python with c++. I am using the boost libraries on gnu/linux. I have many classes (with inheritance) that I would like to expose to python. Is there some way to have many python modules in one file?
I don't think so. I think you can achieve the desired effect using Python API. May be you should take a look on "Creating Packages" tutorial. ( http://boost.org/libs/python/doc/tutorial/doc/html/python/techniques.html#py... ) -- Roman Yakovenko C++ Python language binding http://www.language-binding.net/
It may be a problem related to your library filename (at linking time) that does not match the name you defined in the boot python module: BOOST_PYTHON_MODULE(core) requires for example "core.so" for the name of your library file (at least on linux). Nicolas On Tue, 2006-11-28 at 13:08 +0100, David Sveningsson wrote:
Hi, I am quite new at extending python with c++. I am using the boost libraries on gnu/linux. I have many classes (with inheritance) that I would like to expose to python. Is there some way to have many python modules in one file?
Like, core.so contains a string class and a memory class. I tried just compiling everything as a shared library and importing into python with "import core.string" but then I get the error "ImportError: dynamic module does not define init function (initcore)"
Im not really sure what that means. _______________________________________________ C++-sig mailing list C++-sig@python.org http://mail.python.org/mailman/listinfo/c++-sig
Nicolas Rougier skrev:
It may be a problem related to your library filename (at linking time) that does not match the name you defined in the boot python module:
BOOST_PYTHON_MODULE(core) requires for example "core.so" for the name of your library file (at least on linux).
Yes, but if I have multiple modules in a file it doesn't work
Nicolas
On Tue, 2006-11-28 at 13:08 +0100, David Sveningsson wrote:
Hi, I am quite new at extending python with c++. I am using the boost libraries on gnu/linux. I have many classes (with inheritance) that I would like to expose to python. Is there some way to have many python modules in one file?
Like, core.so contains a string class and a memory class. I tried just compiling everything as a shared library and importing into python with "import core.string" but then I get the error "ImportError: dynamic module does not define init function (initcore)"
Im not really sure what that means. _______________________________________________ C++-sig mailing list C++-sig@python.org http://mail.python.org/mailman/listinfo/c++-sig
_______________________________________________ C++-sig mailing list C++-sig@python.org http://mail.python.org/mailman/listinfo/c++-sig
participants (3)
-
David Sveningsson -
Nicolas Rougier -
Roman Yakovenko