I have the need to dynamically link against a library at run-time and resolve a series of functions using dlsym
. My first thought was to use an array of functio
You should probably define your list as void *functionList[2]
, since dlsym
returns a void *
. Once you know which function you have, you can cast it to the proper type.
void *functionList[2];
...
int (*functionA)(int) = (int(*)(int))functionList[0];
char (*functionB)(char,int) = (char(*)(char, int))functionList[1];