| 1 | #include "SDL.h" |
| 2 | #include <stdio.h> |
| 3 | |
| 4 | #include EXPORT_HEADER |
| 5 | |
| 6 | #if defined(_WIN32) |
| 7 | #include <windows.h> |
| 8 | BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) { |
| 9 | return TRUE; |
| 10 | } |
| 11 | #endif |
| 12 | |
| 13 | int MYLIBRARY_EXPORT mylibrary_init(void); |
| 14 | void MYLIBRARY_EXPORT mylibrary_quit(void); |
| 15 | int MYLIBRARY_EXPORT mylibrary_work(void); |
| 16 | |
| 17 | int mylibrary_init(void) { |
| 18 | SDL_SetMainReady(); |
| 19 | if (SDL_Init(0) < 0) { |
| 20 | fprintf(stderr, "could not initialize sdl2: %s\n", SDL_GetError()); |
| 21 | return 1; |
| 22 | } |
| 23 | return 0; |
| 24 | } |
| 25 | |
| 26 | void mylibrary_quit(void) { |
| 27 | SDL_Quit(); |
| 28 | } |
| 29 | |
| 30 | int mylibrary_work(void) { |
| 31 | SDL_Delay(100); |
| 32 | return 0; |
| 33 | } |