main_lib.c 720 B

1234567891011121314151617181920212223242526272829303132333435
  1. #include <SDL3/SDL.h>
  2. #define SDL_MAIN_HANDLED /* don't drag in header-only SDL_main implementation */
  3. #include <SDL3/SDL_main.h>
  4. #include EXPORT_HEADER
  5. #ifdef _WIN32
  6. #include <windows.h>
  7. BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) {
  8. return TRUE;
  9. }
  10. #endif
  11. int MYLIBRARY_EXPORT mylibrary_init(void);
  12. void MYLIBRARY_EXPORT mylibrary_quit(void);
  13. int MYLIBRARY_EXPORT mylibrary_work(void);
  14. int mylibrary_init(void) {
  15. SDL_SetMainReady();
  16. if (!SDL_Init(0)) {
  17. SDL_Log("Could not initialize SDL: %s\n", SDL_GetError());
  18. return 1;
  19. }
  20. return 0;
  21. }
  22. void mylibrary_quit(void) {
  23. SDL_Quit();
  24. }
  25. int mylibrary_work(void) {
  26. SDL_Delay(100);
  27. return 0;
  28. }