Help - python doesn't see my init method.
by cartersanders other posts by this author
Jan 30 2002 4:26PM messages near this date
RE: [boost] boost bind/functional/reference wrapper/mem_fn
|
Boost.Threads: concept requirements
Hi.
I seem to have succesfully installed Boost, which I am using to
access C++ functions from python, and I am having a problem I don't
understand at all.
I succesfully compiled and ran the getting_started2 code, but
when I try to build a shared library of a certain module, I get the following
error:
> >> import CrGammaMod
Traceback (most recent call last):
File <stdin> , line 1, in ?
ImportError: dynamic module does not define init function
(initCrGammaMod)
> >>
But I have defined it! Code below:
BOOST_PYTHON_MODULE_INIT(CrGammaMod)
{
try
{
// Create an object representing this extension module.
python::module_builder this_module( CrGammaMod );
// Create the Python type object for our extension class.
python::class_builder<CrGamma> CrGamma_class(this_module,
CrGamma );
// Add the __init__ function.
CrGamma_class.def(python::constructor<> ());
// Add a regular member function.
//
CrGamma_class.def(&CrGamma::selectComponent, selectComponent );
}
catch(...)
{
python::handle_exception(); // Deal with the exception for Python
}
}
Here is my null constructor prototype:
class CrGamma
{
public:
CrGamma();
....
and my constructor:
CrGamma::CrGamma()
{
int a=5;
}
Why the heck doesn't this work!??? Is there a chance I am doing
something broken with namespaces?
Thanks-
Carter
|