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
Allow to pass callbacks in varargs #885
Allow to pass callbacks in varargs #885
Conversation
@larskanis Hi! Would you have anything against allowing to pass callbacks via varargs arguments? |
By the way, passing callbacks in varargs might look like a rare use case, but functions of very used libraries like libcurl or sqlite use it. For example, libcurl's CURL_EXTERN CURLcode curl_easy_getinfo(CURL *curl, CURLINFO info, ...); A library called ethon was declaring its arguments as The correct arguments definition needs this PR's fix to work properly. |
@vincentisambart Thank you for implementing this! I merged your PR and did some fine tuning on the master branch. Let me know, if I misunderstood something! I'll try to make a new release soon, but I have only little spare time currently. |
Thanks a lot! No worries, I totally understand spare time is a limited resource. |
Thanks @vincentisambart and @larskanis for the great job you are doing here! one question regarding a release - can I know how long we have to wait for the release? there is quite a lot of people being blocked by it, including me 😄 |
As I explained in #732 (comment), if you passed callbacks in varargs, a
NULL
pointer would be dereferenced and your program would crash.I modified
variadic_invoke
to pass propercallbackParameters
andcallbackCount
torbffi_SetupCallParams
, and that seems to fix the problem.