BindBC / bindbc-sdl

Static & dynamic D bindings to SDL and the SDL_* libraries, compatible with BetterC, @nogc, and nothrow.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

SDL_RenderGeometryRaw should be restricted to SDL 2.0.18+

mdparker opened this issue · comments

SDL_RenderGeometryRaw was introduced in SDL 2.0.18 with a pointer to int as the color parameter. In SDL 2.0.20, it was modified to take a pointer to SDL_Color.

In the binding, the int pointer form is protected in a static if, but with the wrong logic (<2.0.20), and the SDL_Color pointer form is unprotected in a naked else:

https://github.com/BindBC/bindbc-sdl/blob/master/source/sdl/render.d#L201

It should be static if(sdlSupport == SDLSupport.v2_0_18) and else static if(sdlSupport > SDLSupport.v2_0_18).

This came up in Discord when a user tried to use the default support for SDL 2.0.0 and got an error for the missing symbol.

Try again with the latest commit? Can’t test myself until tomorrow but if it works for you I’ll tag a new patch.

It's not me. I just reported it. But I'll pass it on.

I just looked at the commit, and no, that's not going to fix it. The function was added in 2.0.18, so that else needs to be else static if(sdlSupport == SDLSupport.v2_0_18). It doesn't exist in earlier versions.

I just looked at the commit, and no, that's not going to fix it. The function was added in 2.0.18, so that else needs to be else static if(sdlSupport == SDLSupport.v2_0_18). It doesn't exist in earlier versions.

Isn’t static if(sdlSupport >= 2.0.18){ static if(sdlSupport => 2.0.20){} else{ X } } the same as if(sdlSupport == 2.0.18){ X }?

I see. I missed that first static if further up. The original issue must be down to something else then.

I see. I missed that first static if further up. The original issue must be down to something else then.

The commit moves the code into that static if—I think this was what I originally intended when I wrote it?

Good to know I'm not losing my mind :-). The enclosing static if isn't visible in the commit and that threw me off.

I don't expect the person who had the problem will apply the commit. Looks to me like you've got it fixed, though.

I’ll tentatively close this then. Feel free to reopen if the issue persists indeed.