Is it possible to import a shared object (without linking the program with it) and call any function? Thanks.
+6
A:
Yes it is possible.
Windows: use LoadLibrary and GetProcAddress.
POSIX: use dlopen and dlsym.
There is a mini tutorial here.
Brian R. Bondy
2010-04-18 11:51:44
I'm using Linux. I made a simple shared object with a the function "void say_hello()", I could import it without errors with dlopen(), but how can I call the say_hello function?
Eduardo
2010-04-18 12:09:51
@Eduardo: I added a tutorial link above that shows how.
Brian R. Bondy
2010-04-18 12:12:32
Thanks, it worked perfectly. Here is my test: http://eduardo38.netne.net/dlopen_test.tar.gz
Eduardo
2010-04-18 12:23:20