ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> boost
boost
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

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved