Support functions with underscores with SDL_LoadFunction on all platforms?
The dlopen implementation of SDL_LoadFunction automatically prepends underscores to function names if necessary, however the Windows and OS/2 implementations don't, which results in additional workarounds in the EGL and hidapi code.
Would you like to submit a PR?
The os/2 side is handled by https://github.com/libsdl-org/SDL/pull/6430 and the hack in hidapi is removed.
Don't know why the workarounds in SDL_egl.c::SDL_EGL_GetProcAddress are needed, and by who.
Don't know why the workarounds in SDL_egl.c::SDL_EGL_GetProcAddress are needed, and by who.
@slouken (and @icculus): Do you know the reason? As far as I can see, that one is the only thing that keeps this ticket open, because the only other dynamic loader left untouched is win32 where a workaround should not be needed.
Do you know the reason?
I don't know for sure, but historically, before macOS had a real implementation of dlopen(), you had to put an underscore in front of shared library symbols or they wouldn't be found (because the Mach-O format stores symbols like that for reasons I don't know). This isn't needed in modern times, and it was never needed on most platforms, but it's possible there's some thing out there that still requires this. macOS never used EGL, fwiw, but I could imagine stumbling on some platform with the same weirdness about this as early macOS.
Anyhow, no actual answer here, just possible clues.
Do you know the reason?
I don't know for sure, but historically, before macOS had a real implementation of dlopen(),
Even if that were the case, our dlopen version of SDL_LoadFunction already does that. That's why I was asking.
I think the workaround exists because the EGL code used to directly call dlsym, and it was kept when the code was changed to use SDL_LoadFunction in https://github.com/SDL-mirror/SDL/commit/3fcc35f5bb715d897e5001b44b1748fd32c81ab2 despite the fact that it's no longer needed for Unix platforms.
Then we should just remove the underscore thing from there and close this ticket, yes?
Created https://github.com/libsdl-org/SDL/pull/6443 for this
Yeah, I think just remove it.