Skip to content
Snippets Groups Projects
Commit 81ab469b authored by murks's avatar murks
Browse files

Add C program and update README with usage information.

parent 47bdb01a
Branches main
No related tags found
No related merge requests found
# Find SDL2 shared library version
This is a very simple program that lets you find out the version of a SDL2 shared library.
\ No newline at end of file
This is a very simple program that lets you find the version of a SDL2 shared library.
Compile: ```gcc `sdl2-config --libs --cflags` find_version.c -o find_version```
Run against a specific shared library (example): `LD_PRELOAD=./libSDL2-2.0.so.0 ./find_version`
Output:
```
Compiled against SDL version: 2.0.20
Linking against SDL version: 2.0.14
```
The first line is the SDL2 version this program was compiled against. This is just for comparison.
The second line is the SDL2 version of the shared library you specified in LD_PRELOAD.
#include <stdio.h>
#include <SDL.h>
int main(int argc, char *argv[])
{
SDL_version compiled;
SDL_version linked;
SDL_VERSION(&compiled);
SDL_GetVersion(&linked);
printf("Compiled against SDL version:\t%d.%d.%d\n", compiled.major, compiled.minor, compiled.patch);
printf("Linking against SDL version:\t%d.%d.%d\n", linked.major, linked.minor, linked.patch);
return 0;
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment