0.9.16.7: renamed ppc-darwin-{langinfo,dlshim} to
[sbcl.git] / tools-for-build / os-provides-dladdr-test.c
1 /* test to build and run so that we know if we have dladdr
2  */
3
4 /* bloody FSF dlcfn.h won't give us dladdr without this */
5 #define _GNU_SOURCE
6
7 #include <dlfcn.h>
8
9 int main ()
10 {
11    void * handle = dlopen((void*)0, RTLD_GLOBAL | RTLD_NOW);
12    void * addr = dlsym(handle, "printf");
13    Dl_info * info = (Dl_info*) malloc(sizeof(Dl_info));
14    dladdr(addr, info);
15    if (strcmp(info->dli_sname, "printf")) {
16        return 1;
17    } else {
18        return 104;
19    }
20 }