Wrap C function which takes variable lengthed parameters?

{-- Rot13 - Hateme ungrzr2 at ubatxbat.pbz
Fri Dec 14 03:42:46 EST 2001


Courageous <jkraska at san.rr.com> wrote in 
news:1gbj1u8pm1t63ao6bjq98jlh66glf78fnu at 4ax.com:

> Speaking of the problem, it might help the O.P. to post some more
> details of the larger problem to see if there is an additional way
> of achieving what is desired. He might also consider posting to
> comp.lang.c and not posting anything to do with Python. Python
> neither helps nor hinders, it's just its own layer in C.
> 

thank for the helps. I want to wrap the following functions
where the variable length arguements are 'char* label, XPIONTER *value'
pairs which can be get/set with the calls. The argument
list is NULL terminated.
===============================================
char *IMGetIMValues(XIMS ims,...)
char *IMSetIMValues(XIMS ims,...)

ims		specifies the input method service.
...		specifies the variable length argument list to set
		IMValues.

   IMSetIMValues registers one or more IMValues, which are specified by
a variable length argument list programming interface, with the XIMS
structure. Note that IMOpenIM is also used to set all IMValues, and some
IMValues must be set when IMOpenIM is called.
   IMSetIMValues returns NULL if it succeeds to set all the IMValues,
otherwise, it returns the name of the first argument whose value could
not be registered.
=============================================

I was thinking to pass a dictionary to the wrapper function
and the wrapper function will call IMSetIMValues() accordingly.
Since I cannot construct a va_list at the runtime, I don't
know how to call the IMSetIMValues().



More information about the Python-list mailing list