Is there a way to GetModuleHandle(NULL) on Linux to be able to pass that handle into dlsym 3
The documentation for dlopen(3) states:
The function
dlopen()loads the dynamic library file named by the null-terminated stringfilenameand returns an opaque "handle" for the dynamic library. IffilenameisNULL, then the returned handle is for the main program.
Therefore, you can use the value returned by dlopen(NULL) as the handle argument to dlsym().
dlopen(NULL) will give you a handle for the executable.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With