Boost Python Issue
Neal Becker
ndbecker2 at gmail.com
Thu Aug 31 21:04:21 EDT 2006
JDJMSon wrote:
> I was wondering if someone here could help me with a problem I'm having
> building Python extensions with the Boost.Python library.
> Basically, if I have a wrapper class with something like this:
>
> string TestFunc()
> {
> return "Hello World";
> }
>
> BOOST_PYTHON_MODULE(TestClass)
> {
> def("TestFunc",TestFunc);
> }
>
>
> It compiles and I can use it without a problem. However, when I try to
> wrap a class with code like this:
>
> class TestClass
> {
> public:
> TestClass() {};
> ~TestClass() {};
> string TestFunction(){return "Hello World";};
> };
>
> BOOST_PYTHON_MODULE(TestClass)
> {
> class_<TestClass>("TestClass")
> .def("TestFunction",&TestClass.TestFunction)
> ;
> }
>
>
Shouldn't that be:
.def("TestFunction",&TestClass::TestFunction)
> ;
More information about the Python-list
mailing list