[C++-sig] Trouble wrapping a function returning a pointer to a class.

tALSit de CoD talsit at talsit.org
Mon Apr 21 15:48:26 CEST 2003


Hey there!

I'm very very very new to this boost.python, so i might probably be looking 
in all the wrong places.

I have a class and a function:

namespace kikura {
         class cKernel { ... };
         cKernel * getKikuraKernel ();
} // namespace kikura

and I want to wrap it like so:

namespace kikura {
         BOOST_PYTHON_MODULE (kikura) {
                 class_ <cKernel> ("cKernel", init<std::string>());
                 def ("getKikuraKernel", getKikuraKernel);
         }

} // namespace kikura

And it barfs at me with this error:
d:\data\users\tALSit\code\c.c++\usr\boost\boost\python\detail\invoke.hpp(80) 
: error C2514: 
'boost::python::detail::specify_a_return_value_policy_to_wrap_functions_returning<T>' 
: class has no constructors

I am using msvc 7, and boost 1.30.0. If i wrap only the class, it compiles 
fine, but if i try to wrap the function aswell, it gives the above error. 
If i try to export _only_ the function, it gives the same error.

I don't know if this has anything to do with namespaces, which I imagine 
not, but just asking anyway.



   tALSit de CoD  |  talsit.org





More information about the Cplusplus-sig mailing list