summaryrefslogtreecommitdiff
path: root/src/contrib/SDL-2.30.2/cmake/test/main_lib.c
blob: 9801ed56c504e95037bbcac97f0231374b7b0b99 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#include "SDL.h"
#include <stdio.h>

#include EXPORT_HEADER

#if defined(_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) {
        fprintf(stderr, "could not initialize sdl2: %s\n", SDL_GetError());
        return 1;
    }
    return 0;
}

void mylibrary_quit(void) {
    SDL_Quit();
}

int mylibrary_work(void) {
    SDL_Delay(100);
    return 0;
}