- 论坛徽章:
- 0
|
- #include<stdio.h>
- #include<dlfcn.h>
- typedef int (*Lancher)(int,char**);
- typedef void* LibraryHandler;
- int main(int argc,char* argv[])
- {
- LibraryHandler lib_handler;
- //linux
- lib_handler = dlopen("lancher.so",RTLD_LAZY);
- if(!lib_handler){
- printf("unable to load lancher.so:%s\n",dlerror());
- return 0;
- }
-
- Lancher entry_point = NULL;
- entry_point = (Lancher)dlsym(lib_handler,"Lancher");
- if(entry_point==NULL){
- printf("unable to get lachner.so::lancher\n",dlerror());
- return 0;
- }
- int rc = entry_ponit(argc,argv);
-
- int ret = dlclose(lib_handler);
- if(ret<0){
- printf("dlclose failed:%s\n",dlerror());
- }
-
- return 0;
- }
复制代码 但编译的时候 会出现
/tmp/cc6L5bzA.o: In function `main':
main.c .text+0xa6): undefined reference to `entry_ponit'
collect2: ld 返回 1
请问这是怎么回事? |
|