Py_BuildValue for char **?

J

js

Hi,

I'm writing a wrapper module of C API.
To make a C struct data avaiable to Python, I need to map C struct
into a PyObject.
I'm thinking that I use a tuple or dict to represent the struct
but a problem is one of the members of the struct is char **, which is
not supported by
Py_BuildValue.
Is there any idiomatic way of mapping char ** to Python?

Any suggestions, pointers would be appreciated.
 
M

Martin v. Löwis

Is there any idiomatic way of mapping char ** to Python?

My recommendation is to not use Py_BuildValue. Instead, use
PyList_New, and then, in a loop, PyString_FromString/PyList_SetItem.

Regards,
Martin
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,432
Messages
2,571,680
Members
48,796
Latest member
Greg L.

Latest Threads

Top