Home | History | Annotate | Download | only in ltrace.minor
      1 #include <stdlib.h>
      2 #include <stdio.h>
      3 #include <dlfcn.h>
      4 
      5 int main(int argc, char **argv) {
      6 	void *handle;
      7 	int (*test)(int);
      8 	char *error;
      9 
     10 	handle = dlopen ("liblibdl-simple.so", RTLD_LAZY);
     11 	if (!handle) {
     12 		fputs (dlerror(), stderr);
     13 		exit(1);
     14 	}
     15 
     16 	test = dlsym(handle, "test_libdl");
     17 	if ((error = dlerror()) != NULL)  {
     18 		fputs(error, stderr);
     19 		exit(1);
     20 	}
     21 
     22 	printf("%d\n", test(5));
     23 	dlclose(handle);
     24 }
     25