Wrap C function which takes variable lengthed parameters?
{-- Rot13 - Hateme
ungrzr2 at ubatxbat.pbz
Fri Dec 14 20:09:04 EST 2001
Michael Hudson <mwh at python.net> wrote in news:uzo4mgk9e.fsf at python.net:
> "{-- Rot13 - Hateme" <ungrzr2 at ubatxbat.pbz> writes:
>
>> But still I have no idea how to construct a list of arguements
>> passed in from python. There are no standard function calls to
>> create a va_list by handle.
>
> I'm not quite sure what you are asking (probably my fault), but you
> might want to look at the implementation of, say, Py_BuildValue and
> Py_VaBuildValue in the Python source (they're in Python/modsupport.c,
> I think ... yup).
>
What I want is to somehow construct a va_list from a python
list. And then pass the va_list to a C funciton
which ask for a va_list.
Say a list of the form ['arg1', 'arg2', 'arg3']
to a va_list contains
va_list va; // ("arg1", &arg1, "arg2", &arg2, "arg3", &arg3)
Then pass the va_list to a function like:
int GetAttribute(ID id, va_list va);
The Py_BuildValue/Py_VaBuildValue parse a va_list and return
a python tuple object. I was looking for an opposite process:
tuple->va_list.
I try to find a standard way to build a va_list at runtime.
Or maybe there some way for python C API which can pass me
a va_list from python code(not really feasible, I think.)
Thanks.
More information about the Python-list
mailing list