Log

Author Commit Date CI Message
Pali Rohár 5c2ec8f9 2019-06-11T00:54:38 Turn off GUI error messages around LoadLibraryA also in test Otherwise running test show GUI error messages which needs to be closed.
Silvio Traversaro 11ff86bf 2019-06-11T00:19:48 Merge pull request #54 from pali/master Correctly process and indicate errors
Pali Rohár e646c9ab 2019-05-23T20:24:17 Add test for non-library file
Pali Rohár 27319bfc 2019-05-23T20:24:12 Add tests for non-existent file and file with too long name
Pali Rohár f6f6dd2d 2019-05-23T20:24:05 Test that dlerror() returns non-NULL error for failed calls
Pali Rohár 207311ce 2019-05-23T20:23:58 Correctly process and indicate error when file name is too long
Pali Rohár 44589dba 2019-05-23T20:23:50 Correctly process malloc() error in local_add() malloc() may fail, so propagate this error to caller of dlopen().
Pali Rohár 4fe419ca 2019-05-23T20:23:33 Correctly process and indicate error in dlsym() function Function save_err_str() checks for error by GetLastError() call. So ensure that last error is always set when error occurs.
Pali Rohár a5c0031e 2019-05-23T20:22:44 Correctly process and indicate error from LoadLibraryExA() function Function save_err_str() checks for error by GetLastError() call. Calling EnumProcessModules() may change or reset it. So call save_err_str() immediately after LoadLibraryExA().
Silvio Traversaro 1488731c 2019-05-21T18:55:39 Merge pull request #52 from pali/master Call FormatMessage() with FORMAT_MESSAGE_IGNORE_INSERTS
Pali Rohár 9ce1ba6f 2019-05-21T00:35:11 Call FormatMessage() with FORMAT_MESSAGE_IGNORE_INSERTS Documentation says: In particular, it is unsafe to take an arbitrary system error code returned from an API and use FORMAT_MESSAGE_FROM_SYSTEM without FORMAT_MESSAGE_IGNORE_INSERTS.
Silvio Traversaro 0fc1d9de 2019-05-20T23:41:19 Merge pull request #51 from pali/master Load Psapi.dll at runtime, this avoids linking caveat
Pali Rohár f3da31d7 2019-05-06T21:47:33 Load Psapi.dll at runtime, this avoids linking caveat
Silvio Traversaro 84295c9a 2019-05-06T21:02:00 Merge pull request #50 from pali/master Simplify UNICODE build
Pali Rohár e0a58321 2019-04-25T20:01:34 Test also UNICODE builds on AppVeyor CI
Pali Rohár 83add392 2019-04-25T19:36:57 Simplify implementation of save_err_str() Check return value of FormatMessageA() function and remove copy_string() function as it is not needed.
Pali Rohár d9d49f2d 2019-04-25T19:26:23 Remove ifdef hack for snprintf() Old version of MSVC does not support snprintf() function and sprintf_s() is not replacement for C99 snprintf(). As the only usage of snprintf() is to format void* pointer we can use sprintf() with enough long buffer.
Pali Rohár 04bbf248 2019-04-25T18:18:31 Simplify code around #ifdef UNICODE The whole dlfcn.h API works with char* (ANSI) strings. For WINAPI UNICODE builds it is still possible to call WINAPI ANSI functions with -A suffix. E.g. LoadLibraryExA() instead of LoadLibraryEx() or FormatMessageA() instead of FormatMessage(). This simplify whole implementation when compiling with UNICODE support as there is no need to do conversion from wchar_t to char and vice-versa.
Silvio Traversaro 278c782a 2019-02-14T14:57:29 Merge pull request #44 from pali/master Fix resolving global symbols and implement RTLD_DEFAULT and RTLD_NEXT
Pali Rohár 63d7bda4 2019-01-29T22:57:04 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.
Pali Rohár 29c46a54 2019-01-29T22:38:42 Fix resolving global symbols when LoadLibrary() is called after dlopen() Usage of first_automatic_object cache is wrong. This cache is filled by all loaded DLL files (either implicitly or explicitly with LoadLibrary() call) by EnumProcessModules() call at first usage of dlopen(). So dlsym() can resolve global symbols only if they were loaded prior to dlopen() call. Any future usage of LoadLibrary() does not include newly loaded DLLs into first_automatic_object cache. To fix this problem, first_automatic_object cache is fully removed and EnumProcessModules() call is issued directly in dlsym() call. As EnumProcessModules() returns all DLLs, included those which were loaded by dlopen() with RTLD_LOCAL, it may break RTLD_LOCAL support. To address this problem switch linked-list of all loaded DLLs with RTLD_GLOBAL to linked-list of all loaded DLLs with RTLD_LOCAL flag. And then skip modules from EnumProcessModules() which are in linked-list. Also in WinAPI all DLLs loaded by LoadLibrary() behaves like RTLD_GLOBAL. So above change is compatible with this behavior. There may be another problem. Before retrieving HMODULE for DLL filename (which is done by LoadLibrary()), it is not possible to detect if DLL was already loaded by RTLD_LOCAL or not. And after calling LoadLibrary() it is not possible to know if DLL was loaded either by dlsym() with RTLD_LOCAL or by LoadLibrary() (which is equivalent to RTLD_GLOBAL). To address this problem, compare number of loaded modules (counted by EnumProcessModules()) before and after LoadLibrary() called from dlsym(). If number does not change it means that DLL was already loaded. So based on this result either add or remove HMODULE from linked-list of RTLD_LOCAL modules. Added test demonstrate usage of: global = dlopen(NULL, RTLD_GLOBAL); /* global handle */ LoadLibrary("library.dll"); /* this provides function */ function = dlsym(global, "function"); /* resolve function from library.dll */
Silvio Traversaro 1530bed6 2019-02-14T08:37:16 Merge pull request #48 from dlfcn-win32/appveyor-mingw-take-two Add MinGW and MinGW-w64 builds to AppVeyor (take 2)
Silvio Traversaro 23d77533 2019-02-11T00:31:22 Add MinGW and MinGW-w64 tests to AppVeyor
Silvio Traversaro f1acf5d2 2018-03-08T09:20:45 Merge pull request #41 from jddurand/master #include <stdlib.h>
Jean-Damien Durand d26298df 2018-01-17T10:02:39 #include <stdlib.h>
Silvio Traversaro f1edc335 2017-09-27T18:36:26 Merge pull request #40 from dlfcn-win32/document-cmake-usage Document how to use the library when using CMake
Silvio Traversaro b30b758e 2017-08-24T21:50:51 Mention the possibility of defining CMAKE_DL_LIBS
Silvio Traversaro de4a39d3 2017-08-24T21:43:59 Document how to use the library when using CMake
Silvio Traversaro 2d03bf63 2017-05-04T20:14:12 Merge pull request #39 from dlfcn-win32/traversaro-patch-2 [README] Fix AppVeyor badge
Silvio Traversaro 7c60c2d3 2017-05-04T13:20:27 [README] Fix AppVeyor badge
Silvio Traversaro ef7e412d 2017-05-04T13:12:09 Merge pull request #38 from dlfcn-win32/appveyor-test-vs2017 [appveyor] Test the library using Visual Studio 15 2017
Silvio Traversaro 49606058 2017-05-04T13:12:01 Merge pull request #36 from dlfcn-win32/fix-dlerror Fix bug in dlerror second consecutive call
Silvio Traversaro 96e723b7 2017-05-01T11:57:32 [appveyor] Test the library using Visual Studio 15 See https://www.appveyor.com/docs/build-environment/ for the logic behind the option used.
Silvio 5bcd8c53 2017-05-01T11:03:01 Fix bug in dlerror second consecutive call According to the specs, a second consecutive call to dlerror should always return NULL . This was the case in dlfcn-win32 before https://github.com/dlfcn-win32/dlfcn-win32/pull/20 introduce a regression that caused dlerror to crash on the second consecutive call. In this commit the issue is fixed as suggested in https://github.com/dlfcn-win32/dlfcn-win32/issues/34 and a regression test has been added.
Silvio Traversaro 18195b17 2017-04-09T17:51:35 Merge pull request #30 from Kamekameha/appveyor-fix Minor AppVeyor configuration cleanup
Kamekameha 8e853e00 2017-03-16T04:32:53 Minor AppVeyor configuration cleanup
Silvio Traversaro 69bd6d5c 2017-03-19T17:06:28 [readme] Update AppVeyor badge
Silvio Traversaro e37edf0e 2017-03-10T00:02:02 Merge pull request #29 from traversaro/add-appveyor Fix tests in Visual Studio 2015 and add AppVeyor support
Silvio d22f7719 2017-03-05T16:48:00 Add testing of CMake exported targets
Silvio Traversaro e32762ce 2017-03-05T16:30:10 Add AppVeyor badge
Silvio Traversaro bf146adb 2017-02-22T00:23:40 Add appveyor support
Silvio 540fa7a4 2017-03-05T16:16:16 Fix tests in Visual Studio 2015 For checking the loading of symbols from the global handle, the printf symbol was loaded, but since Visual Studio 2015 printf is defined as a inline function. To fix this, the test has been modified to load the symbol of the fwrite function.
Silvio Traversaro ad70f0eb 2017-03-05T09:50:55 Merge pull request #27 from traversaro/add-cmake-config-file Add CMake code to export a CMake config file
Silvio bd4eebdb 2016-12-27T12:13:39 Add CMake code to export a CMake config file
Boris Nagaev e19bf076 2016-07-25T13:49:13 configure: put test.{c,dll} to current directory (#26) instead of /tmp/ to avoid races when building for multiple targets. Add test files to .gitignore and `make clean`.
Timothy Gu 00d5cd18 2016-03-23T02:20:15 Merge pull request #25 from xantares/patch-1 Removed wine detection
xantares 604fd008 2016-03-23T09:43:39 Removed wine detection It can be set canonically by using CMAKE_CROSSCOMPILIING_EMULATOR variable
Timothy Gu 7cea745e 2015-08-06T14:33:43 Merge pull request #20 from robertwgh/unicode Added support for unicode character set.
Guohui Wang aa1401bf 2015-04-09T03:30:39 Added support for unicode character set.
Timothy Gu e419539b 2015-04-06T18:48:30 Update README.md Fixes #18.
Timothy Gu 98cc37be 2015-03-15T19:07:44 Add my copyright Not that I care…
Timothy Gu c5501073 2015-03-15T17:32:10 Warning control in MSVC
Timothy Gu 50f42865 2015-03-15T17:26:46 Revert "Use level 4 warnings for Visual Studio" This reverts commit 77a6dfd8c588a64300ea380bf32256da3b93f1ef.
Timothy Gu f5e9a16f 2015-03-15T17:21:34 Use SHARED macro to handle DLL export (Originally the SHARED macro is created not to handle this case, but it seems like it works fine for this purpose as well.) Closes #12.
Timothy Gu 54740be1 2015-03-15T17:16:40 Merge branch 'global-loaded-mods' Closes #9.
Timothy Gu dd4254a3 2014-10-08T15:50:21 Add linked modules to a separate global list Fixes #2.
Timothy Gu 5ea707ad 2015-03-15T16:35:22 Define SHARED when building shared library
Timothy Gu c421b701 2015-03-15T16:09:44 Check for memory leak when _DEBUG is defined
Timothy Gu 77a6dfd8 2015-03-15T15:55:52 Use level 4 warnings for Visual Studio
Timothy Gu ce706da1 2015-03-11T22:38:54 Merge pull request #10 from xantares/patch-5 set CMAKE_BUILD_TYPE default
xantares 473386e3 2015-03-12T06:37:29 set CMAKE_BUILD_TYPE default it's used to set release flags
Timothy Gu 081924ee 2015-03-11T20:16:05 Add static **configurations**
Timothy Gu efa69675 2015-03-11T20:15:49 Revert "Add a static solution" This reverts commit 22dd588b852abd5a8de6cd09aa5c876883435ecd.
Timothy Gu 22dd588b 2015-03-11T20:12:53 Add a static solution
Timothy Gu b70639dc 2015-03-11T20:12:25 Do not use dllimport in any case
Timothy Gu 6d7e94b2 2015-03-11T20:03:04 Add Visual Studio 12 files CMake sucks.
Dennis Nienhüser 83432ba2 2015-03-11T20:00:11 Add import/export symbols for MSVC. This results in an import .lib file. Closes #4. Some fixes by Timothy Gu <timothygu99@gmail.com> Signed-off-by: Timothy Gu <timothygu99@gmail.com>
Timothy Gu 87f5cd06 2015-03-11T19:48:56 Use more secure sprintf_s()
Timothy Gu bc08f587 2015-03-11T18:31:27 Don't ignore VS files
Timothy Gu ecaf0e90 2015-03-11T18:15:40 Add .gitignore
Timothy Gu 9e5c2eb2 2015-03-11T17:15:03 Merge pull request #7 from xantares/patch-3 only one rule to generate shared/export lib Fixes #1
Timothy Gu e69d90ee 2015-03-11T17:11:55 Merge pull request #6 from xantares/patch-2 add CFLAGS var
xantares cb7a22d4 2015-03-10T10:49:17 only one rule to generate shared/export lib or else the rule is applied to libdl.dll AND libdl.dll.a: x86_64-w64-mingw32-gcc -Wl,--out-implib,libdl.dll.a -shared -o libdl.dll dlfcn.o x86_64-w64-mingw32-gcc -Wl,--out-implib,libdl.dll.a -shared -o libdl.dll.a dlfcn.o
xantares f869380a 2015-03-03T08:49:31 add CFLAGS
Timothy Gu 6a6ebd39 2014-09-23T17:28:16 Merge pull request #3 from xantares/cmake Initial cmake port
xantares 484b7dc8 2014-09-23T13:44:10 Initial cmake port
Timothy Gu cf563063 2014-08-19T11:20:31 Rename README to README.md
Timothy Gu 4c3754da 2014-08-17T00:11:08 Fix test DLL export Fixes issue 16. Patch by Nathan Rajlich <nathan@tootallnate.net>
Timothy Gu 665499d0 2014-03-27T02:58:02 Build sys additions * wine support for testing * License boilerplate * Reorder configure checks
Timothy Gu e16a6e8e 2014-02-10T03:46:33 test: add trying to load nonexistent symbols test
Timothy Gu 043b3358 2014-02-10T03:35:19 test: add forgotten test "Open library again (without closing it first) with RTLD_GLOBAL"
Timothy Gu f1642131 2014-02-10T03:30:50 test: more updates and fixes
Timothy Gu 507ae09f 2014-02-10T03:08:12 test.c: make errors stand out
Timothy Gu 346543d6 2014-02-10T03:05:45 License stuff
Timothy Gu bef2f446 2014-02-10T02:59:58 README: Markdown-ize and add rand() stuff
Timothy Gu 2ef1b924 2014-02-07T05:14:53 Makefile: cosmetics
Timothy Gu 39829878 2014-02-07T05:14:03 Makefile: some rework with better dependency tracking More to come later
Timothy Gu f92c7718 2014-01-22T04:26:18 Fix local symbol in global handle test
Timothy Gu cd276891 2014-01-22T04:24:38 test.c: return 1 if error
Timothy Gu 539e732b 2014-01-22T04:12:43 Fix error checking in copy_string()
Timothy Gu b9be226f 2014-01-20T16:36:17 Remove extraneous CloseHandle Fixes issue 13.
Timothy Gu 63d66aac 2014-01-20T03:09:20 Silences "echo ignoring *"
Timothy Gu 29e7d7af 2014-01-20T02:05:49 Make configure return 0 on success
Timothy Gu 53c31d96 2014-01-20T01:59:11 Add C++ extern "C" See Issue 8 and Issue 12.
Ramiro Polla 0e8ad87f 2012-10-10T22:15:21 configure: fix setting $prefix
Ramiro Polla b1180795 2012-10-10T22:15:10 configure: use $incdir and $libdir directly in help
Ramiro Polla f290240c 2012-10-10T22:14:56 lowercase PREFIX variables
Ramiro Polla 5976daa8 2009-01-11T21:59:46 Clear ->next after creating nobject.
Ramiro Polla 5da418e9 2009-01-11T21:31:27 Move libcmd to configure.
Ramiro Polla 3cacb13d 2009-01-11T21:28:05 Fix stripping when cross-compiling.