SDL 3.0
SDL_version.h File Reference
+ Include dependency graph for SDL_version.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  SDL_Version
 

Macros

#define SDL_MAJOR_VERSION   3
 
#define SDL_MINOR_VERSION   1
 
#define SDL_PATCHLEVEL   2
 
#define SDL_VERSION(x)
 
#define SDL_VERSIONNUM(major, minor, patch)    ((major) << 24 | (minor) << 8 | (patch) << 0)
 
#define SDL_COMPILEDVERSION    SDL_VERSIONNUM(SDL_MAJOR_VERSION, SDL_MINOR_VERSION, SDL_PATCHLEVEL)
 
#define SDL_VERSION_ATLEAST(X, Y, Z)    (SDL_COMPILEDVERSION >= SDL_VERSIONNUM(X, Y, Z))
 

Functions

int SDL_GetVersion (SDL_Version *ver)
 
const char * SDL_GetRevision (void)
 

Detailed Description

This header defines the current SDL version.

Definition in file SDL_version.h.

Macro Definition Documentation

◆ SDL_COMPILEDVERSION

#define SDL_COMPILEDVERSION    SDL_VERSIONNUM(SDL_MAJOR_VERSION, SDL_MINOR_VERSION, SDL_PATCHLEVEL)

This is the version number macro for the current SDL version.

Since
This macro is available since SDL 3.0.0.

Definition at line 108 of file SDL_version.h.

◆ SDL_MAJOR_VERSION

#define SDL_MAJOR_VERSION   3

Definition at line 61 of file SDL_version.h.

◆ SDL_MINOR_VERSION

#define SDL_MINOR_VERSION   1

Definition at line 62 of file SDL_version.h.

◆ SDL_PATCHLEVEL

#define SDL_PATCHLEVEL   2

Definition at line 63 of file SDL_version.h.

◆ SDL_VERSION

#define SDL_VERSION (   x)
Value:
{ \
(x)->major = SDL_MAJOR_VERSION; \
(x)->minor = SDL_MINOR_VERSION; \
(x)->patch = SDL_PATCHLEVEL; \
}
#define SDL_MINOR_VERSION
Definition SDL_version.h:62
#define SDL_PATCHLEVEL
Definition SDL_version.h:63
#define SDL_MAJOR_VERSION
Definition SDL_version.h:61

Macro to determine SDL version program was compiled against.

This macro fills in an SDL_Version structure with the version of the library you compiled against. This is determined by what header the compiler uses. Note that if you dynamically linked the library, you might have a slightly newer or older version at runtime. That version can be determined with SDL_GetVersion(), which, unlike SDL_VERSION(), is not a macro.

Parameters
xA pointer to an SDL_Version struct to initialize.
Since
This macro is available since SDL 3.0.0.
See also
SDL_Version
SDL_GetVersion

Definition at line 82 of file SDL_version.h.

83{ \
84 (x)->major = SDL_MAJOR_VERSION; \
85 (x)->minor = SDL_MINOR_VERSION; \
86 (x)->patch = SDL_PATCHLEVEL; \
87}

◆ SDL_VERSION_ATLEAST

#define SDL_VERSION_ATLEAST (   X,
  Y,
 
)     (SDL_COMPILEDVERSION >= SDL_VERSIONNUM(X, Y, Z))

This macro will evaluate to true if compiled with SDL at least X.Y.Z.

Since
This macro is available since SDL 3.0.0.

Definition at line 116 of file SDL_version.h.

◆ SDL_VERSIONNUM

#define SDL_VERSIONNUM (   major,
  minor,
  patch 
)     ((major) << 24 | (minor) << 8 | (patch) << 0)

This macro turns the version numbers into a numeric value.

(1,2,3) becomes 0x1000203.

Parameters
majorthe major version number.
minorthe minorversion number.
patchthe patch version number.
Since
This macro is available since SDL 3.0.0.

Definition at line 100 of file SDL_version.h.

Function Documentation

◆ SDL_GetRevision()

const char * SDL_GetRevision ( void  )
extern

Get the code revision of SDL that is linked against your program.

This value is the revision of the code you are linked with and may be different from the code you are compiling with, which is found in the constant SDL_REVISION.

The revision is arbitrary string (a hash value) uniquely identifying the exact revision of the SDL library in use, and is only useful in comparing against other revisions. It is NOT an incrementing number.

If SDL wasn't built from a git repository with the appropriate tools, this will return an empty string.

You shouldn't use this function for anything but logging it for debugging purposes. The string is not intended to be reliable in any way.

Returns
an arbitrary string, uniquely identifying the exact revision of the SDL library in use.
Since
This function is available since SDL 3.0.0.
See also
SDL_GetVersion

◆ SDL_GetVersion()

int SDL_GetVersion ( SDL_Version ver)
extern

Get the version of SDL that is linked against your program.

If you are linking to SDL dynamically, then it is possible that the current version will be different than the version you compiled against. This function returns the current version, while SDL_VERSION() is a macro that tells you what version you compiled with.

This function may be called safely at any time, even before SDL_Init().

Parameters
verthe SDL_Version structure that contains the version information
Returns
0 on success or a negative error code on failure; call SDL_GetError() for more information.
Since
This function is available since SDL 3.0.0.
See also
SDL_GetRevision