Re: How to handle C functions with variable number of args
Greg Ewing <[email protected]> Thu, 20 Nov 2008 13:18:28 +1300
| Newsgroups | gmane.comp.python.pyrex |
|---|---|
| Message-ID | <[email protected]> |
Dog Walker wrote: > cdef extern int xosd_display(xosd * osd, int line, xosd_command > command, ...) except -1 > > def displaytext(self, line, command, *arg): > #and then call the xosd_display function declared above There is no support in Pyrex for passing on a *args argument to a C varargs function. Although the concepts are vaguely similar, they're really very different things. You'll have to iterate over the *args, inspect their types and make an appropriate series of single-arg calls to get the effect you want. > Where is handling C varargs in Pyrex documented, btw? Apparently it's not documented anywhere. :-( But there's not really much to say -- you can declare an external function as taking varargs, and you can call it with some number of arguments fixed at the point of call. That's about all. -- Greg