[C++-sig] (Stefan Seefeld) pass function pointerto c

Qinfeng(Javen) Shi shiqinfeng at gmail.com
Wed Oct 18 02:03:00 CEST 2006


Hi Stefan,

>Python has no notion of pointer. So, the float * is accepted, but
>that's because for convenience the boost.python side accepts it as a
>pointer to a single item. You can't pass arrays like that.
>(You may want to look at http://boost.org/libs/python/doc/v2/indexing.html
>to see how you can export containers.)

I saw this indexing method. I want to expose float* to python, so that
boost::python::object(float*,float*) is callable in c extension.

But here float* is not a class. If even I "typedef float* vector;", then
expose vector as following,
 class_<vector>("Vec")
        .def(vector_indexing_suite<vector>())
    ;

it will report a error."error: `float*' is not a class, struct, or union
type"

Could you tell me how to expose it?

Thanks.
-- 
Qinfeng(Javen) Shi

Research School of Information Sciences and Engineering
Australian National University
Locked Bag 8001
Canberra ACT 2601
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/cplusplus-sig/attachments/20061018/d54025e1/attachment.htm>


More information about the Cplusplus-sig mailing list