tomato-testing/cmake/test/main_lib.c
Green Sky dec0d4ec41 Squashed 'external/sdl/SDL/' content from commit b8d91252c
git-subtree-dir: external/sdl/SDL
git-subtree-split: b8d91252c6488cf9c645aba447b56bb9dbd9609a
2023-07-25 22:27:55 +02:00

35 lines
723 B
C

#include <SDL3/SDL.h>
#define SDL_MAIN_HANDLED /* don't drag in header-only SDL_main implementation */
#include <SDL3/SDL_main.h>
#include EXPORT_HEADER
#ifdef _WIN32
#include <windows.h>
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) {
return TRUE;
}
#endif
int MYLIBRARY_EXPORT mylibrary_init(void);
void MYLIBRARY_EXPORT mylibrary_quit(void);
int MYLIBRARY_EXPORT mylibrary_work(void);
int mylibrary_init(void) {
SDL_SetMainReady();
if (SDL_Init(0) < 0) {
SDL_Log("Could not initialize SDL: %s\n", SDL_GetError());
return 1;
}
return 0;
}
void mylibrary_quit(void) {
SDL_Quit();
}
int mylibrary_work(void) {
SDL_Delay(100);
return 0;
}