aboutsummaryrefslogtreecommitdiff
path: root/Makefile
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 /Makefile
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 'Makefile')
-rw-r--r--Makefile7
1 files changed, 5 insertions, 2 deletions
diff --git a/Makefile b/Makefile
index a0f5cb9..efac5af 100644
--- a/Makefile
+++ b/Makefile
@@ -66,10 +66,13 @@ test.exe: test.o $(TARGETS)
66testdll.dll: testdll.c 66testdll.dll: testdll.c
67 $(CC) -shared -o $@ $^ 67 $(CC) -shared -o $@ $^
68 68
69testdll2.dll: testdll2.c $(TARGETS)
70 $(CC) -shared -o $@ $< -L. -ldl $(LIBS)
71
69testdll3.dll: testdll3.c 72testdll3.dll: testdll3.c
70 $(CC) -shared -o $@ $^ 73 $(CC) -shared -o $@ $^
71 74
72test: $(TARGETS) test.exe testdll.dll testdll3.dll 75test: $(TARGETS) test.exe testdll.dll testdll2.dll testdll3.dll
73 $(WINE) test.exe 76 $(WINE) test.exe
74 77
75clean:: 78clean::
@@ -77,7 +80,7 @@ clean::
77 dlfcn.o \ 80 dlfcn.o \
78 libdl.dll libdl.a libdl.def libdl.dll.a libdl.lib libdl.exp \ 81 libdl.dll libdl.a libdl.def libdl.dll.a libdl.lib libdl.exp \
79 tmptest.c tmptest.dll \ 82 tmptest.c tmptest.dll \
80 test.exe testdll.dll testdll3.dll 83 test.exe testdll.dll testdll2.dll testdll3.dll
81 84
82distclean: clean 85distclean: clean
83 rm -f config.mak 86 rm -f config.mak