Replies: 2 comments
-
Hi Jonathan, It's great to hear that you're getting on well with ctypes. Calling a variadic function as if it were non-variadic isn't strictly portable, but is guaranteed to work on particular platforms. The ABI for each platform/architecture generally makes clear whether there are different calling conventions for variadic and non-variadic functions. More solid support for calling variadic functions is something I'd like to add in future. I doubt it'll be workable to specify full variadic prototypes -- typing the ellipses is likely to prove challenging! -- but specifying the types of particular calls should be possible. Let's leave this issue open for now. |
Beta Was this translation helpful? Give feedback.
-
Yes, I actually chatted a little bit with Xavier after reporting the issue, and it turns out that on my particular ABI, the calling convention is the same for variadic and non-variadic, which is the reason why it works. Thanks for the thorough explanation! |
Beta Was this translation helpful? Give feedback.
-
Hi Jeremy,
I'm playing a little bit with your excellent Ctypes library, and I've been really impressed. I needed to perform an
ioctl
call, and sinceioctl
is a variadic function, I just did:which turns out to be the type of the function, given my particular usage of it. Guess what? It's worked out perfectly so far!
I couldn't find a word about that in chapter 19 or even in the wiki on github, so I think it would be worth mentioning, regardless of whether it's meant to work or not.
Cheers!
~ jonathan
Beta Was this translation helpful? Give feedback.
All reactions