SDL_version.h File Reference
`#include <SDL3/SDL_stdinc.h>`
`#include <SDL3/SDL_begin_code.h>`
`#include <SDL3/SDL_close_code.h>`
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 4
#define | SDL_MICRO_VERSION 2
#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 2

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 4

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

#define SDL_VERSION SDL_VERSIONNUM(SDL_MAJOR_VERSION, SDL_MINOR_VERSION, SDL_MICRO_VERSION)

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

\threadsafety It is safe to call this macro from any thread.

Since
  This macro is available since SDL 3.2.0.

See also
  SDL_GetVersion

Definition at line 129 of file SDL_version.h.

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

## SDL_VERSION_ATLEAST

#define SDL_VERSION_ATLEAST | ( |  | X,
|  |  | Y,
|  |  | Z )

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

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

\threadsafety It is safe to call this macro from any thread.

Since
  This macro is available since SDL 3.2.0.

Definition at line 139 of file SDL_version.h.

#define SDL_VERSION_ATLEAST(X, Y, Z) \
(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

  major | the major version number.
  minor | the minorversion number.
  patch | the patch version number.

Since
  This macro is available since SDL 3.2.0.

Definition at line 78 of file SDL_version.h.

#define SDL_VERSIONNUM(major, minor, patch) \
((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

  version | the version number.

\threadsafety It is safe to call this macro from any thread.

Since
  This macro is available since SDL 3.2.0.

Definition at line 92 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

  version | the version number.

\threadsafety It is safe to call this macro from any thread.

Since
  This macro is available since SDL 3.2.0.

Definition at line 118 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

  version | the version number.

\threadsafety It is safe to call this macro from any thread.

Since
  This macro is available since SDL 3.2.0.

Definition at line 105 of file SDL_version.h.

## Function Documentation

## SDL_GetRevision()

const char * SDL_GetRevision | ( | void |  | ) |

extern

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

This value is the revision of the code you are linking against and may be different from the code you are compiling with, which is found in the constant SDL_REVISION if you explicitly include SDL_revision.h

The revision is an 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.

\threadsafety It is safe to call this function from any thread.

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.

\threadsafety It is safe to call this function from any thread.

Since
  This function is available since SDL 3.2.0.

See also
  SDL_GetRevision