1 #include <aros/config.h>
3 #include <aros/symbolsets.h>
5 #include "hostgl_renderer_config.h"
6 #include "x11_hostlib.h"
8 #include <proto/hostlib.h>
10 #include LC_LIBDEFS_FILE
13 #include <aros/debug.h>
15 void *x11_handle
= NULL
;
16 struct x11_func x11_func
;
18 static const char *x11_func_names
[] =
23 #if defined(RENDERER_SEPARATE_X_WINDOW)
35 void *x11_hostlib_load_so(const char *sofile
, const char **names
, void **funcptr
)
42 D(bug("[HostGL] loading %d functions from %s\n", nfuncs
, sofile
));
44 if ((handle
= HostLib_Open(sofile
, &err
)) == NULL
)
46 kprintf("[HostGL] couldn't open '%s': %s\n", sofile
, err
);
50 while((name
= names
[i
]) != NULL
)
52 funcptr
[i
] = HostLib_GetPointer(handle
, name
, &err
);
53 D(bug("%s(%x)\n", names
[i
], funcptr
[i
]));
56 kprintf("[HostGL] couldn't get symbol '%s' from '%s': %s\n", names
[i
], sofile
, err
);
57 HostLib_Close(handle
, NULL
);
63 D(bug("[x11] done\n"));
68 static int x11_hostlib_init(LIBBASETYPEPTR LIBBASE
)
70 D(bug("[HostGL] X11 hostlib init\n"));
72 if ((HostLibBase
= OpenResource("hostlib.resource")) == NULL
)
74 kprintf("[HostGL] couldn't open hostlib.resource\n");
78 if ((x11_handle
= x11_hostlib_load_so(X11_SOFILE
, x11_func_names
, (void **) &x11_func
)) == NULL
)
80 HostLib_Close(x11_handle
, NULL
);
87 static int x11_hostlib_expunge(LIBBASETYPEPTR LIBBASE
)
89 D(bug("[HostGL] X11 hostlib expunge\n"));
91 if (x11_handle
!= NULL
)
92 HostLib_Close(x11_handle
, NULL
);
97 ADD2INITLIB(x11_hostlib_init
, 0)
98 ADD2EXPUNGELIB(x11_hostlib_expunge
, 0)