[C++-sig] Re: C arrays solution

David Abrahams dave at boost-consulting.com
Tue Oct 14 01:12:22 CEST 2003


"Niall Douglas" <s_sourceforge at nedprod.com> writes:

> boost::python::class_<FXObjectList, 
> boost::noncopyable>("FXObjectList")
>         .def("getData", MakeCArray(&FXObjectList::getData, 
> &FXObjectList::getDataLen))
>
> And bam!, in one fell swoop the problem is solved.

I'm not sure I know exactly what problem you're solving (what do you
expect to be able to do with the result of this getData call?)  but
your use of a global pointer to hold the result is terribly
unsafe... not to mention the fact that your code leaks CArray objects
like a sieve.

If you're satisfied with that, I guess I'm satisfied.  Otherwise,
perhaps you'd like to post a little more detail about how you want to
be able to *use* this code from Python?  I think people here,
especially Raoul, should be able to make some suggestions which would
solve the problem in a more principled way.

-- 
Dave Abrahams
Boost Consulting
www.boost-consulting.com





More information about the Cplusplus-sig mailing list