How can I cast void* to int ( * () ) (int,...)?
The void* is coming from a dlsym. This code isn't compiling:
typedef int ( *PSYS () ) (int,...);
PSYS getf = (PSYS) dlsym(lib, "function" );
How can I cast void* to int ( * () ) (int,...)?
The void* is coming from a dlsym. This code isn't compiling:
typedef int ( *PSYS () ) (int,...);
PSYS getf = (PSYS) dlsym(lib, "function" );
If the symbol is a function pointer your typedef may be wrong. Should be:
typedef int (*PSYS)(int, ...);
PSYS is the type of a function, not a pointer to a function. You want
typedef int ( *PSYS () ) (int,...);
PSYS* getf = (PSYS*) dlsym(lib, "function" );