[C++-sig] Returning a simple char *
Nicolas Lelong
nico_ml at mgdesign.fr
Tue Jan 12 15:06:24 CET 2010
IMO, the easiest route would be to wrap the member functions :
namespace {
std::string video_getDeviceName_wrapped(int deviceID)
{
char* name = videoInput::getDeviceName(devideID);
std::string result(name);
// free 'name' memory if needed
return result;
}
}
and then ::
using namespace boost::python;
BOOST_PYTHON_MODULE(pyVideoInput)
{
class_<videoInput>("videoInput")
.def("getDeviceName", &video_getDeviceName_wrapped)
.staticmethod("getDeviceName")
;
}
and you should be done.
More information about the Cplusplus-sig
mailing list