1. //testso1.c 
  2. #include <stdio.h> 
  3. int so1func1() 
  4.     printf("so1func1\n"); 
  5.     return 0; 
  6. int so1func2() 
  7.     printf("so1func2\n"); 
  8.     return 0; 
  9. //testso2.c 
  10. #include <stdio.h> 
  11. int so1func1(); 
  12. int so2func1() 
  13.     printf("so2func1_ call so1func1\n"); 
  14.     so1func1(); 
  15.     return 0; 
  16.  
  17. //main.c 
  18. #include <stdio.h> 
  19. #include <stdlib.h> 
  20. #include <dlfcn.h> 
  21.  
  22. //    int  so1func1(); 
  23. //    int  so2func2(); 
  24.  
  25. int main(int argc, char *argv[]) 
  26.     typedef int (*UI_MAIN)(); 
  27.     void *handle = NULL; 
  28.  
  29.     printf("test_main\n"); 
  30. // load core 
  31.     handle = dlopen("./libtestso1.so", RTLD_GLOBAL|RTLD_LAZY); 
  32.     //handle = dlopen("./libtestso1.so", RTLD_LAZY); 
  33.     if(!handle){ 
  34.          printf("read ui_core error: %s \n", dlerror()); 
  35.          return 1; 
  36.     } 
  37.       UI_MAIN ui_main = (UI_MAIN) dlsym(handle, "so1func1"); 
  38.       if (ui_main) 
  39.           ui_main(); 
  40.  
  41.     handle = dlopen("./libtestso2.so", RTLD_LAZY); 
  42.     if(!handle){ 
  43.          printf("read ui_main error: %s \n", dlerror()); 
  44.          return 1; 
  45.     } 
  46.  
  47.       ui_main = (UI_MAIN) dlsym(handle, "so2func1"); 
  48.  
  49.       if (ui_main) 
  50.           ui_main(); 
  51.       else
  52.           printf("read symbol error: %s \n", dlerror()); 
  53.           return 1; 
  54.       } 
  55.      //so1func1(); 
  56.      //so2func2(); 
  57.      return 0;