|
Boost : |
From: cartersanders (boost_at_[hidden])
Date: 2002-01-30 11:26:24
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
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk