7 #define LIBNAME "libstatic.so"
9 int load_and_test(void)
12 int (*mystatic)(void);
14 handle = dlopen(LIBNAME, RTLD_LAZY);
16 fprintf(stderr, "Could not open ./%s: %s\n", LIBNAME, dlerror());
20 mystatic = dlsym(handle, "static_test");
21 if (mystatic == NULL) {
22 fprintf(stderr, "Could not locate symbol 'static_test': %s\n", dlerror());
27 fprintf(stderr, "mystatic() failed: static vars were not setup properly\n");
36 int main(int argc, char **argv)