testver.c 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. /*
  2. Copyright (C) 1997-2014 Sam Lantinga <slouken@libsdl.org>
  3. This software is provided 'as-is', without any express or implied
  4. warranty. In no event will the authors be held liable for any damages
  5. arising from the use of this software.
  6. Permission is granted to anyone to use this software for any purpose,
  7. including commercial applications, and to alter it and redistribute it
  8. freely.
  9. */
  10. /* Test program to compare the compile-time version of SDL with the linked
  11. version of SDL
  12. */
  13. #include <stdio.h>
  14. #include <stdlib.h>
  15. #include "SDL.h"
  16. #include "SDL_revision.h"
  17. int
  18. main(int argc, char *argv[])
  19. {
  20. SDL_version compiled;
  21. SDL_version linked;
  22. /* Enable standard application logging */
  23. SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);
  24. #if SDL_VERSION_ATLEAST(2, 0, 0)
  25. SDL_Log("Compiled with SDL 2.0 or newer\n");
  26. #else
  27. SDL_Log("Compiled with SDL older than 2.0\n");
  28. #endif
  29. SDL_VERSION(&compiled);
  30. SDL_Log("Compiled version: %d.%d.%d.%d (%s)\n",
  31. compiled.major, compiled.minor, compiled.patch,
  32. SDL_REVISION_NUMBER, SDL_REVISION);
  33. SDL_GetVersion(&linked);
  34. SDL_Log("Linked version: %d.%d.%d.%d (%s)\n",
  35. linked.major, linked.minor, linked.patch,
  36. SDL_GetRevisionNumber(), SDL_GetRevision());
  37. SDL_Quit();
  38. return (0);
  39. }