Support varargs
Opened this issue · 0 comments
It's not really clear how to support varargs exactly. The CAPI
convention does have support varargs functions, but it's very limited: you have to specify a precise set of arguments, and ghc
then generates a wrapper that takes precisely those arguments and in turn calls the original varargs function.
https://stackoverflow.com/questions/5989457/haskell-ffi-support-for-functions-with-variadic-arguments lists some options here; the most promising is perhaps using libffi
to push an arbitrary number of arguments to the stack before calling the function (though obviously if we do go down this road we should provide a nice and type-safe API for this).
We will need examples of what exactly is desirable before we can make progress here.