Use SB!IMPL as the implementation package for PARSE-BODY
[sbcl.git] / tools-for-build / os-provides-dladdr-test.c
blobc78c84dc23676cbbe512133d1d246cd06b8c85b8
1 /* test to build and run so that we know if we have dladdr
2 */
4 /* bloody FSF dlcfn.h won't give us dladdr without this */
5 #define _GNU_SOURCE
7 #include <stdlib.h>
8 #include <dlfcn.h>
10 int main ()
12 #ifdef __NetBSD__
13 /* dladdr(3) is broken on NetBSD currently, don't forget to replace
14 with a version check when they fix it */
15 return 1;
16 #else
17 void * handle = dlopen((void*)0, RTLD_GLOBAL | RTLD_NOW);
18 void * addr = dlsym(handle, "printf");
19 Dl_info * info = (Dl_info*) malloc(sizeof(Dl_info));
20 if (dladdr(addr, info) == 0) {
21 return 1;
22 } else {
23 return 104;
25 #endif