Jump to content
Setting up an AI agent? ReverseEngineering.wiki skill (works from the command line, no configuration): https://reverseengineering.wiki/skill/rewiki/SKILL.md · setup for every client, including MCP: https://reverseengineering.wiki/llms.txt · REWiki:Connect

Library:SDL

From ReverseEngineering.wiki
Library
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.0 or SDL3.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_DRIVER and other SDL_ hint names, plus the revision string: SDL_REVISION is generated by CMake from git (template include/build_config/SDL_revision.h.cmake). Verified in the SDL2 branch (commit 8acf7cfc0f88): the CMake build sets SDL_REVISION to SDL-<git describe> (for example SDL-release-2.24.0-542-g96361fc47), SDL-<version>-g<sha> when only a SHA is available, or SDL-<version>-no-vcs; with SDL_VENDOR_INFO set it appends (<vendor>). build-scripts/updaterev.sh writes the same SDL-<rev> form. Search a binary for the string SDL-.
  • 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) fills struct SDL_version { Uint8 major, minor, patch; } (include/SDL_version.h); const char *SDL_GetRevision(void) and int SDL_GetRevisionNumber(void) exist too. There is no SDL_Linked_Version in SDL2: that name is from SDL 1.2 (returns a pointer); SDL2 replaced it with SDL_GetVersion, and SDL_VERSION() fills the compile-time version. Library file names: Windows SDL2.dll (the .rc has OriginalFilename SDL2.dll; the export-library defs use 'SDL2.dll'); Linux libSDL2-2.0.so.0 (CMake OUTPUT_NAME SDL2-2.0, soname .so.0, real file libSDL2-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 in src/dynapi/SDL2.exports; the dynamic API table can redirect calls to another library named in the SDL_DYNAMIC_API environment variable, so a game may call through stubs.
  • Many functions were renamed between SDL2 and SDL3, so imports like SDL_Init do 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