classes not wrappable by boost::python

Are there certain classes not wrappable by boost::python? I'm trying to wrap a class, but am hitting errors when using it as opposed to a dummy class.

The following doesn't work...

#include <manu/manu.h>

void foo()
{
    // can call non-member Kernel(), which returns Kernel instance
    manu::Kernel* kernel = manu::Kernel(); 
}

BOOST_PYTHON_MODULE(mymodule)
{
    using namespace boost::python;
    class_<manu::Kernel>("Kernel", no_init) // doesn't like this
    ;
}

I can use it in a function, but putting it in the class_ template I get the following error:

manu_python.cpp:9: error: expected constructor, destructor, or type conversion before ‘*’ token
manu_python.cpp: In function ‘void init_module_manu()’:
manu_python.cpp:17: error: type/value mismatch at argument 1 in template parameter list for ‘template<class T, class X1, class X2, class X3> class boost::python::class_’
manu_python.cpp:17: error:   expected a type, got ‘manu::Kernel’

but using a dummy class does work.

class Foo
{
};

BOOST_PYTHON_MODULE(mymodule)
{
    using namespace boost::python;
    class_<Foo>("Kernel", no_init)
    ;
}

The full class is defined in manu.h, but not fully declared there. Is this class just not exposeable to python?

In manu.h, there is a class called Kernel and a non-member function called Kernel(), which returns an instance of Kernel. Does this function shadow the Kernel class from being used in templates? And if so, is there a way to tell the templates I've referring to the class and not the function declaration?

Answers


I came across the same problem and found this website: http://qiita.com/nishio/items/daff0e9be30f4b4d6fca

The few readable bits solved the problem for me:

#include <boost/python/class.hpp>

Need Your Help

Copy Data From 1 Database to Other Using IF

php mysql sql database phpmyadmin

Hi i have 2 databases in local host i want to copy UPC field from one to other if their product models are same?

SNMP+ SHELL SCRIPTING+ php

php shell snmp

I am running an snmp command on my bash script