Better abstractions for target struct manipulation in host.
[sbcl.git] / tools-for-build / os-provides-dladdr-test.c
blob1c2ac4577d2a1adadfd4dccfb49c225f45c30243
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 void * handle = dlopen((void*)0, RTLD_GLOBAL | RTLD_NOW);
13 void * addr = dlsym(handle, "printf");
14 Dl_info * info = (Dl_info*) malloc(sizeof(Dl_info));
15 if (dladdr(addr, info) == 0) {
16 return 1;
17 } else {
18 return 104;