Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support varargs #53

Open
edsko opened this issue Aug 2, 2024 · 0 comments
Open

Support varargs #53

edsko opened this issue Aug 2, 2024 · 0 comments

Comments

@edsko
Copy link
Collaborator

edsko commented Aug 2, 2024

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.

@edsko edsko added this to the 4: Additional features milestone Aug 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant