Results 1 to 1 of 1
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 ...
- 02-26-2008 #1Just Joined!
- Join Date
- Feb 2008
- Posts
- 1
implementing plugins with dlopen/dlsym
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:
What I want is the program to outputCode: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"); } ...
"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


Reply With Quote