00001
00002
00003 #include <stdio.h>
00004 #include <dlfcn.h>
00005 #include <errno.h>
00006 #include <string.h>
00007
00008 void dim_lock()
00009 {
00010 static void (*func)(void);
00011
00012 if(!func) {
00013 dlerror();
00014 if (!(func = (void (*)()) dlsym(RTLD_NEXT, "dim_lock"))) printf("%s\n", dlerror());
00015 }
00016 printf("dim_lock() is called\n");
00017 func();
00018 return;
00019 }
00020
00021 dim_unlock()
00022 {
00023
00024 static void (*func)(void);
00025
00026 if(!func) {
00027 dlerror();
00028 if (!(func = (void (*)()) dlsym(RTLD_NEXT, "dim_unlock"))) printf("%s\n", dlerror());
00029 }
00030 printf("dim_unlock() is called\n");
00031 func();
00032 return;
00033 }