A
anonimo
Hello everyone,
i want to dinamically load one new function with dlopen()+dlsym(). As
we all know, the problem is that ISO C++ does not allow to safely cast
from void* to pointer-to-function and viceversa.
But I had an idea about a possible workaround and I would like to hear
your opinions: instead of getting a pointer to function with dlsym()
from the object file, I could get a pointer to an
array-of-pointers-to-functions and reference the first element to obtain
the pointer to the function I need. On the other side, in the object
file, I could use a global instance of a "proxy class" to dinamically
initialize this array at loading time, so that the first element will
contain the correct address of the function.
Thanks in advance.
i want to dinamically load one new function with dlopen()+dlsym(). As
we all know, the problem is that ISO C++ does not allow to safely cast
from void* to pointer-to-function and viceversa.
But I had an idea about a possible workaround and I would like to hear
your opinions: instead of getting a pointer to function with dlsym()
from the object file, I could get a pointer to an
array-of-pointers-to-functions and reference the first element to obtain
the pointer to the function I need. On the other side, in the object
file, I could use a global instance of a "proxy class" to dinamically
initialize this array at loading time, so that the first element will
contain the correct address of the function.
Thanks in advance.