00001 #include <dlfcn.h>
00002 #include <stdio.h>
00003 #include <stdlib.h>
00004
00005 #include "lkc.h"
00006
00007 #define P(name,type,arg) type (*name ## _p) arg
00008 #include "lkc_proto.h"
00009 #undef P
00010
00011 void kconfig_load(void)
00012 {
00013 void *handle;
00014 char *error;
00015
00016 handle = dlopen("./libkconfig.so", RTLD_LAZY);
00017 if (!handle) {
00018 handle = dlopen("./base/config/kconfig/libkconfig.so", RTLD_LAZY);
00019 if (!handle) {
00020 fprintf(stderr, "%s\n", dlerror());
00021 exit(1);
00022 }
00023 }
00024
00025 #define P(name,type,arg) \
00026 { \
00027 name ## _p = dlsym(handle, #name); \
00028 if ((error = dlerror())) { \
00029 fprintf(stderr, "%s\n", error); \
00030 exit(1); \
00031 } \
00032 }
00033 #include "lkc_proto.h"
00034 #undef P
00035 }