tsdl icon indicating copy to clipboard operation
tsdl copied to clipboard

Add fixed-arity stub for SDL_Log

Open jonahbeckford opened this issue 10 months ago • 5 comments

Fix for #99

(I still need to test this on Windows and Linux.)

jonahbeckford avatar Apr 02 '24 11:04 jonahbeckford

Do you have an idea why the current scheme doesn't work ? There are bindings to snprintf in ctypes' test suite here and it doesn't seem to be doing anything particular or different from what is being done here.

Perhaps @yallop has an idea ? (The signature of the function being bound to is here).

dbuenzli avatar Apr 02 '24 11:04 dbuenzli

Per https://gcc.gnu.org/bugzilla/show_bug.cgi?id=26744#c1 ("vararg functions support in libffi is not supported"):

libffi does not support variable arguments at all.

That was an old message for Apple (so it is clear that Apple testing is important) because at some point varargs was added to libffi:

https://www.chiark.greenend.org.uk/doc/libffi-dev/html/The-Basics.html

If the function being called is variadic (varargs) then ffi_prep_cif_var must be used instead of ffi_prep_cif.

snprintf passing a test suite was luck, or perhaps the test suite did not include Apple.

jonahbeckford avatar Apr 03 '24 21:04 jonahbeckford

s/Apple/macOS/

jonahbeckford avatar Apr 03 '24 21:04 jonahbeckford

FYI: Do not merge this as-is. I think I introduced a regression in this PR ... the new symbol caml_tsdl_log1arg needs to be in the stub, and for Windows that means it needs __declspec(export). I had mistakenly only tested this PR with macOS.

I'll finish off a new round of Linux/macOS/Windows testing in <48 hrs, and update this PR.

jonahbeckford avatar Apr 23 '24 05:04 jonahbeckford

Finished testing (later than expected due to unrelated package's bug) and updated the PR.

It is good to go.

jonahbeckford avatar Apr 27 '24 15:04 jonahbeckford