I have a question regarding the implementation of plugins. I am compiling my plugin module as a dynamic library and using dlopen/dlsym to open it and access functions in the module. This all works fine.

The question I have is whether I can in some way call functions that are implemented in the "base" program from the loaded module.

example:
Code:
module.c:
  ...
  void test(){
    printf("Hello\n");
    base_func();
  }
  ...
base.c:
  ...
  int main(){
    ...
    handle=dlopen(module.so,RTLD_NOW|RTLD_GLOBAL);
    fptr=dlsym(handle,test);
    (*fptr)();
    ...
  }
  void base_func(){
    printf("Hi\n");
  }
  ...
What I want is the program to output
"Hello
Hi"
but, at runtime I get an exception stating I am trying to resolve an undefined symbol. Now if I understand correctly after dlopen all the code shares an address space, so there should be a way to do his right??

Any help is appreciated.

thanks
-pfoh