Quote:
Originally Posted by raskin
I think that ‘‘man dlopen’’ could enlighten you. dlopen opens .so library, dlsym takes result of dlopen and a function name and returns function address.
|
A simpler alternative to dlopen is linking to the library and using the function directly (the symbol resolution is performed automatically instead of manually).
So something like this:
Code:
extern void functionA(char c);
int main(void)
{
char fname[20];
printf(">> ");
scanf("%s",fname);
functionA(fname[0]);
return 0;
}
And then, during linking, you would specify that your executable be linked with the library (either static or shared).