Don't ask to ask, just ask | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
It need not be too bad. Here's an Inline::C demo where the function has a FILE* as it's first argument, a string as its second argument, and a variable number of following arguments (all of which are unsigned integers). If you want to see what a valid XS file looks like just uncomment # CLEAN_AFTER_BUILD => 0, (before you have run the script) and take a look in the _Inline/build directory at the XS file that was autogenerated.
Update: Script modified slightly from when first posted But there's a problem ... what if the third and subsequent args aren't all unsigned integers ? What if they're an ad hoc mixture of integers, doubles, and strings ? That obviously complicates things. You might be able to convert each of those arguments to the appropriate C type by examining the flags associated with them. Or, you might be able to derive that info by decoding the fmt string (2nd arg). Either way, it's not all that pretty. (I don't know of any other way - but that doesn't mean that an alternative doesn't exist.) Cheers, Rob In reply to Re: C Functions with variable argument list in perlxs
by syphilis
|
|