>This facilitates certain types of programming. The question then
>was probably, what Linux APIs can be used for late binding of a
>library (comparable to the above mentioned windows APIs).
>
>I don't know the answer, and this is off topic, but I would be
>interested in knowing the answer as well.
man 3 dlopen says more than I can.
make sure you link against libdl
Sample late binding:
#include <dlfcn.h>
typdef int *Function(int);
void main(void)
{
void *hn;
Function foo;
if (!(hn = dlopen("mydll.so", O_RDONLY))) {
printf("dlopen: %s\n", dlerror());
exit(-1);
}
if (!(foo = dlsym(hn, "func_bar"))) {
printf("dlsym: %s\n", dlerror());
exit(-1);
}
printf("func_bar(1) from mydll.so returned %d\n",
(*foo)(1));
}
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.altern.org/andrebalsa/doc/lkml-faq.html