aboutsummaryrefslogtreecommitdiff
path: root/cmake-test
diff options
context:
space:
mode:
authorPali Rohár <pali.rohar@gmail.com>2019-01-29 22:57:04 +0100
committerPali Rohár <pali.rohar@gmail.com>2019-02-14 09:25:21 +0100
commit63d7bda42322bb0916e30bc547123a8330a4dcc2 (patch)
tree71d0ea65a3c604982b20445384392fbdbce6d136 /cmake-test
parent29c46a54ffa31513be1a2cdcd9e8a55938d6e549 (diff)
downloaddlfcn-win32-63d7bda42322bb0916e30bc547123a8330a4dcc2.tar.gz
dlfcn-win32-63d7bda42322bb0916e30bc547123a8330a4dcc2.tar.bz2
dlfcn-win32-63d7bda42322bb0916e30bc547123a8330a4dcc2.zip
Implement support for dlsym() with RTLD_DEFAULT and RTLD_NEXT
dlsym() with RTLD_DEFAULT handle behaves in same way like with global handle returned by dlopen() with NULL file name. dlsym() with RTLD_NEXT handle search for next loaded module which provides specified symbol. "Next" means module which in EnumProcessModules() result after the module which called dlsym(). To get caller function of dlsym() use _ReturnAddress() intrinsic. To get module where is caller function use the fact that HMODULE is the same value as the module's base address. When compiling under gcc, defines _ReturnAddress() macro via gcc's builtin as it does not provide MSC's specific _ReturnAddress() intrinsic. Added tests demonstrate that both RTLD_DEFAULT and RTLD_NEXT are working as expected.
Diffstat (limited to 'cmake-test')
-rw-r--r--cmake-test/CMakeLists.txt3
1 files changed, 3 insertions, 0 deletions
diff --git a/cmake-test/CMakeLists.txt b/cmake-test/CMakeLists.txt
index b853920..659a79a 100644
--- a/cmake-test/CMakeLists.txt
+++ b/cmake-test/CMakeLists.txt
@@ -8,6 +8,9 @@ find_package(dlfcn-win32 REQUIRED)
8 8
9add_library(testdll SHARED ../testdll.c) 9add_library(testdll SHARED ../testdll.c)
10set_target_properties(testdll PROPERTIES PREFIX "") 10set_target_properties(testdll PROPERTIES PREFIX "")
11add_library(testdll2 SHARED ../testdll2.c)
12set_target_properties(testdll2 PROPERTIES PREFIX "")
13target_link_libraries(testdll2 dlfcn-win32::dl)
11add_library(testdll3 SHARED ../testdll3.c) 14add_library(testdll3 SHARED ../testdll3.c)
12set_target_properties(testdll3 PROPERTIES PREFIX "") 15set_target_properties(testdll3 PROPERTIES PREFIX "")
13add_executable(t_dlfcn ../test.c) 16add_executable(t_dlfcn ../test.c)