-
Notifications
You must be signed in to change notification settings - Fork 15
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
SDL version test should be done at runtime #3
Comments
No, this just means that if you build with SDL >= 2.0.5 you need SDL >= 2.0.5 at runtime as well, which I think is reasonable. |
I have no control over what version of SDL2 is used at runtime. As is common, I ship my app (in the case of Linux, anyway) without bundling SDL2, the user has to get it from the repository for his Linux distro (it's often pre-loaded). If the version in that repository is < 2.0.5, my app won't run at all - the loader will abort because of the missing I think this applies in the case of the Raspberry Pi 2 (and probably Raspberry Pi 3 too). I don't think the version of SDL2 in their repositories has ever changed, or ever will. Those older Raspberry Pis are still available for purchase and are still supported, and it's an important platform for me.. I use the mechanism I described - late binding at run time - for the |
It is not realistic that a Linux user has SDL < 2.0.5 on their system. Even debian oldoldstable has 2.0.5. |
Sorry, your reply crossed with my edit. I added that I think older Raspberry Pis may still use versions of SDL2 prior to 2.0.5. That's an unusual platform, because all the models are still available for purchase and are still supported. |
Don't all Raspberry Pis support the current (32bit) version of Raspberry Pi OS (formerly Raspbian)? |
Even if so, people don't update Raspberry Pis like they might a conventional Linux platform. There is no automatic version checking and prompting to upgrade, not least because it means burning a new SD card. Incompatibilities with things like video drivers (which recent releases of Raspberry Pi OS have broken for many people) mean it's common for ancient releases still to be in use. I can't say to my users that they must update their OS to run my app. |
Do you have any kind of numbers on that? Even the old Raspbian based on Debian buster has SDL 2.0.9, I think. |
I'm afraid I don't. But I know that large numbers of old RPis are still in use, and I strongly suspect many of them will be running Jessie and Stretch. I know I wouldn't want to risk updating my OS if the machine is otherwise working perfectly. Still, I understand your reluctance to make the change if the numbers are small, even though it's a simple and painless modification I guess I can wait until the complaints start coming in.... |
Stretch should have 2.0.5 (at least debian stretch does) running an unsupported OS without security updates doesn't seem very smart to me |
I know, but as I said the Raspberry Pi is a very untypical platform, in some ways more like an embedded system than a general-purpose computer, and often without internet access. And I can't rule out that some people may use my app in a turnkey system, booting straight into BBC BASIC with no user interaction. But if it's the case that Stretch has 2.0.5 I am less worried than I was; my recollection is that my Raspberry Pi 3 doesn't have |
The latest version of SDL_stbimage.h includes some code conditional on the version of SDL, which is achieved as follows:
#if SDL_VERSION_ATLEAST(2, 0, 5)
Whilst this is fine when SDL2 is incorporated in a static build, it's problematical when an application is linked at runtime with a shared SDL2 library, such as SDL2.dll in Windows or libSDL2.so in Linux. This is because the conditional test is not checking the linked version of SDL2, but rather what headers happened to be used at compile time.
To ensure that such an application runs successfully with a shared version of SDL prior to 2.0.5 (unlikely, but possible with an old Windows or Linux installation) it would be necessary to perform the version check at run-time and use 'late binding' for the missing
SDL_CreateRGBSurfaceWithFormatFrom()
function to avoid a load-time error.Indeed the version check would be superfluous, because getting the function address at run time with
SDL_LoadObject()
andSDL_LoadFuncition()
would tell you whether it was available!The text was updated successfully, but these errors were encountered: