make.tmpl: add missing compiler attribute to build_progs
[AROS.git] / test / misc / hostlib.c
blob54a405fb4badfdf761f1507d50d8286b9ab32c34
1 /*
2 Copyright © 1995-2014, The AROS Development Team. All rights reserved.
3 $Id$
4 */
6 #include <proto/exec.h>
7 #include <proto/hostlib.h>
8 #include <proto/dos.h>
9 #include <stdio.h>
11 APTR HostLibBase;
13 int (*SDL_Init) (ULONG flags);
14 void * (*SDL_SetVideoMode) (int width, int height, int bpp, ULONG flags);
15 void (*SDL_Quit) (void);
17 int main(int argc, char **argv) {
18 void *handle;
19 char *err;
21 if ((HostLibBase = OpenResource("hostlib.resource")) == NULL) {
22 fprintf(stderr, "can't open hostlib.resource\n");
23 return 1;
26 if ((handle = HostLib_Open("libSDL.so", &err)) == NULL) {
27 fprintf(stderr, "can't open sdl: %s\n", err);
28 return 1;
31 SDL_Init = HostLib_GetPointer(handle, "SDL_Init", NULL);
32 SDL_SetVideoMode = HostLib_GetPointer(handle, "SDL_SetVideoMode", NULL);
33 SDL_Quit = HostLib_GetPointer(handle, "SDL_Quit", NULL);
35 SDL_Init(0x20);
36 SDL_SetVideoMode(640, 480, 16, 0);
38 Delay(250);
40 SDL_Quit();
42 HostLib_Close(handle, NULL);
44 return 0;