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.

Macros

#define SDL_MAJOR_VERSION   3
 
#define SDL_MINOR_VERSION   2
 
#define SDL_MICRO_VERSION   8
 
#define SDL_VERSIONNUM(major, minor, patch)
 
#define SDL_VERSIONNUM_MAJOR(version)
 
#define SDL_VERSIONNUM_MINOR(version)
 
#define SDL_VERSIONNUM_MICRO(version)
 
#define SDL_VERSION    SDL_VERSIONNUM(SDL_MAJOR_VERSION, SDL_MINOR_VERSION, SDL_MICRO_VERSION)
 
#define SDL_VERSION_ATLEAST(X, Y, Z)
 

Functions

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

Macro Definition Documentation

◆ SDL_MAJOR_VERSION

#define SDL_MAJOR_VERSION   3

CategoryVersion

Functionality to query the current SDL version, both as headers the app was compiled against, and a library the app is linked to. The current major version of SDL headers.

If this were SDL version 3.2.1, this value would be 3.

Since
This macro is available since SDL 3.2.0.

Definition at line 47 of file SDL_version.h.

◆ SDL_MICRO_VERSION

#define SDL_MICRO_VERSION   8

The current micro (or patchlevel) version of the SDL headers.

If this were SDL version 3.2.1, this value would be 1.

Since
This macro is available since SDL 3.2.0.

Definition at line 65 of file SDL_version.h.

◆ SDL_MINOR_VERSION

#define SDL_MINOR_VERSION   2

The current minor version of the SDL headers.

If this were SDL version 3.2.1, this value would be 2.

Since
This macro is available since SDL 3.2.0.

Definition at line 56 of file SDL_version.h.

◆ SDL_VERSION

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

Since
This macro is available since SDL 3.2.0.
See also
SDL_GetVersion

Definition at line 121 of file SDL_version.h.

121#define SDL_VERSION \
122 SDL_VERSIONNUM(SDL_MAJOR_VERSION, SDL_MINOR_VERSION, SDL_MICRO_VERSION)

◆ SDL_VERSION_ATLEAST

#define SDL_VERSION_ATLEAST ( X,
Y,
Z )
Value:
#define SDL_VERSIONNUM(major, minor, patch)
Definition SDL_version.h:78
#define SDL_VERSION

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

Since
This macro is available since SDL 3.2.0.

Definition at line 129 of file SDL_version.h.

129#define SDL_VERSION_ATLEAST(X, Y, Z) \
130 (SDL_VERSION >= SDL_VERSIONNUM(X, Y, Z))

◆ SDL_VERSIONNUM

#define SDL_VERSIONNUM ( major,
minor,
patch )
Value:
((major) * 1000000 + (minor) * 1000 + (patch))

This macro turns the version numbers into a numeric value.

(1,2,3) becomes 1002003.

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

Definition at line 78 of file SDL_version.h.

78#define SDL_VERSIONNUM(major, minor, patch) \
79 ((major) * 1000000 + (minor) * 1000 + (patch))

◆ SDL_VERSIONNUM_MAJOR

#define SDL_VERSIONNUM_MAJOR ( version)
Value:
((version) / 1000000)

This macro extracts the major version from a version number

1002003 becomes 1.

Parameters
versionthe version number.
Since
This macro is available since SDL 3.2.0.

Definition at line 90 of file SDL_version.h.

◆ SDL_VERSIONNUM_MICRO

#define SDL_VERSIONNUM_MICRO ( version)
Value:
((version) % 1000)

This macro extracts the micro version from a version number

1002003 becomes 3.

Parameters
versionthe version number.
Since
This macro is available since SDL 3.2.0.

Definition at line 112 of file SDL_version.h.

◆ SDL_VERSIONNUM_MINOR

#define SDL_VERSIONNUM_MINOR ( version)
Value:
(((version) / 1000) % 1000)

This macro extracts the minor version from a version number

1002003 becomes 2.

Parameters
versionthe version number.
Since
This macro is available since SDL 3.2.0.

Definition at line 101 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.2.0.
See also
SDL_GetVersion

◆ SDL_GetVersion()

int SDL_GetVersion ( void )
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 the version you compiled with.

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

Returns
the version of the linked library.
Since
This function is available since SDL 3.2.0.
See also
SDL_GetRevision