GetModuleHandle(NULL) on Linux

前端 未结 2 1371
借酒劲吻你
借酒劲吻你 2021-01-05 22:52

Is there a way to GetModuleHandle(NULL) on Linux to be able to pass that handle into dlsym 3

2条回答
  •  走了就别回头了
    2021-01-05 23:40

    The documentation for dlopen(3) states:

    The function dlopen() loads the dynamic library file named by the null-terminated string filename and returns an opaque "handle" for the dynamic library. If filename is NULL, 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().

提交回复
热议问题