Is there a way to GetModuleHandle(NULL)
on Linux to be able to pass that handle into dlsym 3
dlopen(NULL)
will give you a handle for the executable.
The documentation for dlopen
(3) states:
The function
dlopen()
loads the dynamic library file named by the null-terminated stringfilename
and returns an opaque "handle" for the dynamic library. Iffilename
isNULL
, 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()
.