Library:SDL
Appearance
| Developer | Sam Lantinga, libsdl-org |
|---|---|
| License | Zlib |
| Website | https://libsdl.org |
| On this wiki | Facts · Code · Notes · Topics |
Simple DirectMedia Layer (libsdl-org): cross-platform window, input, audio and GPU abstraction used by many games and emulators; SDL2 (SDL2.dll) and SDL3 (SDL3.dll) differ in ABI, and SDL_GetVersion is the call that tells them apart.
Identification
- Dynamic builds ship
SDL2.dll/libSDL2-2.0.so.0orSDL3.dll/libSDL3.so.0. The DLL name separates the generations. - A static SDL has no such file. Look for strings such as
SDL_VIDEODRIVER,SDL_RENDER_DRIVERand otherSDL_hint names, plus the revision string:SDL_REVISIONis generated by CMake from git (templateinclude/build_config/SDL_revision.h.cmake). Verified in the SDL2 branch (commit 8acf7cfc0f88): the CMake build setsSDL_REVISIONtoSDL-<git describe>(for exampleSDL-release-2.24.0-542-g96361fc47),SDL-<version>-g<sha>when only a SHA is available, orSDL-<version>-no-vcs; withSDL_VENDOR_INFOset it appends(<vendor>).build-scripts/updaterev.shwrites the sameSDL-<rev>form. Search a binary for the stringSDL-. - SDL3 (main branch, header version 3.5.0 at the pinned commit):
int SDL_GetVersion(void)returns one number,SDL_VERSIONNUM(major,minor,patch)= major1000000 + minor1000 + patch;const char *SDL_GetRevision(void)returns the revision string. - SDL2 (branch
SDL2, header version 2.33.0 at commit 8acf7cfc0f88):void SDL_GetVersion(SDL_version *ver)fillsstruct SDL_version { Uint8 major, minor, patch; }(include/SDL_version.h);const char *SDL_GetRevision(void)andint SDL_GetRevisionNumber(void)exist too. There is noSDL_Linked_Versionin SDL2: that name is from SDL 1.2 (returns a pointer); SDL2 replaced it withSDL_GetVersion, andSDL_VERSION()fills the compile-time version. Library file names: WindowsSDL2.dll(the.rchas OriginalFilenameSDL2.dll; the export-library defs use'SDL2.dll'); LinuxlibSDL2-2.0.so.0(CMake OUTPUT_NAMESDL2-2.0, soname.so.0, real filelibSDL2-2.0.so.0.<minor*100>.<micro>, e.g. 2.24.1 gives.0.2400.1). SDL3 drops the doubled version:SDL3.dll,libSDL3.so.0. SDL2 exports are listed insrc/dynapi/SDL2.exports; the dynamic API table can redirect calls to another library named in theSDL_DYNAMIC_APIenvironment variable, so a game may call through stubs. - Many functions were renamed between SDL2 and SDL3, so imports like
SDL_Initdo not tell the generation; use the DLL name or the SDL_GetVersion signature.
Code & repositories
- https://github.com/libsdl-org/SDL @
8acf7cfc0f88717e5c036f60f0314bfcafe39189· license: Zlib
SDL2 branch: SDL_version.h, CMake library naming, SDL2.exports.
Tested on: source read, not run: source read, not run (branch SDL2) · checked 2026-10-18; last activity 2026-10-18; Note: the latest release ships binaries; the wiki links only the source, never the binaries