GetModuleHandle(NULL) on Linux
Is there a way to GetMo开发者_如何学编程duleHandle(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 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()
.
dlopen(NULL)
will give you a handle for the executable.
精彩评论