In the following C++
code, I am attempting to load a function from a shared library.
void* tmp = dlsym(dl_lib, symbol);
_fun = reinterpret_cast<plot_sample_fun*>(tmp);
However, the reinterpret_cast
segfaults when converting the pointers. What is wrong here?
Edit:
To provide further context,
typedef void plot_sample_fun( const void *, double **, char ***, size_t *);
class Foo {
void bar(); // Loads _fun as above.
plot_sample_fun* _fun;
};