r6308@lvps87-230-33-50: verhaegs | 2007-12-03 22:24:30 +0100
[AROS.git] / test / hostlib.c
blob9d4b7ef649b3647d04e11c92ef4959dc074d7e54
1 #include <proto/exec.h>
2 #include <proto/hostlib.h>
3 #include <proto/dos.h>
4 #include <stdio.h>
6 APTR HostLibBase;
8 int (*SDL_Init) (ULONG flags);
9 void * (*SDL_SetVideoMode) (int width, int height, int bpp, ULONG flags);
10 void (*SDL_Quit) (void);
12 int main(int argc, char **argv) {
13 void *handle;
14 char *err;
16 if ((HostLibBase = OpenResource("hostlib.resource")) == NULL) {
17 fprintf(stderr, "can't open hostlib.resource\n");
18 return 1;
21 if ((handle = HostLib_Open("libSDL.so", &err)) == NULL) {
22 fprintf(stderr, "can't open sdl: %s\n", err);
23 return 1;
26 SDL_Init = HostLib_GetPointer(handle, "SDL_Init", NULL);
27 SDL_SetVideoMode = HostLib_GetPointer(handle, "SDL_SetVideoMode", NULL);
28 SDL_Quit = HostLib_GetPointer(handle, "SDL_Quit", NULL);
30 SDL_Init(0x20);
31 SDL_SetVideoMode(640, 480, 16, 0);
33 Delay(250);
35 SDL_Quit();
37 HostLib_Close(handle, NULL);
39 return 0;