Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

SDL version test should be done at runtime #3

Copy link
Copy link

Description

@rtrussell
Issue body actions

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() and SDL_LoadFuncition() would tell you whether it was available!

Reactions are currently unavailable

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    Morty Proxy This is a proxified and sanitized view of the page, visit original site.