Log

Author Commit Date CI Message
Silvio Traversaro 06ffb62a 2020-12-22T17:31:32 Merge pull request #93 from rhabacker/travis-cmake-support Add cmake build support to travis CI
Ralf Habacker 38ea653d 2020-12-22T10:57:10 Add cmake build support to travis CI
Silvio Traversaro 1f0a9b1b 2020-12-13T19:02:34 Merge pull request #90 from pali/master Rewrite function save_err_ptr_str() to not use sprintf()
Pali Rohár d230e1ca 2020-12-13T14:48:44 Rewrite function save_err_ptr_str() to not use sprintf() sprintf() is marked by MSVC as unsafe and suppressing compile warning does not work. It is still generated on AppVeyor. So rewrite code for converting pointer number to string via open coded for-loop and do not use unsafe sprintf() function anymore. New code correctly handles both 32bit and 64bit variants and does not use any #ifdef _MSC_VER anymore.
Silvio Traversaro b1b55b2a 2020-12-13T12:10:41 Merge pull request #89 from pali/master Add _CRT_SECURE_NO_WARNINGS for test.c to disable MSVC deprecation warnings
Pali Rohár e042c1de 2020-12-13T02:22:06 Add _CRT_SECURE_NO_WARNINGS for test.c to disable MSVC deprecation warnings
Silvio Traversaro 5f1c9149 2020-12-13T01:29:18 Merge pull request #88 from pali/master Run Travis tests also under i586-mingw32msvc-gcc compiler
Pali Rohár 22020637 2020-12-12T02:47:24 ci-build.sh: Move install_prefix to cmake place where it is used
Pali Rohár 3cddb7b9 2020-12-12T01:02:47 Run Travis tests also under i586-mingw32msvc-gcc compiler Beware that i586-mingw32msvc-gcc is sometimes just a symlink to i686-w64-mingw32-gcc. Real i586-mingw32msvc-gcc compiler is available in mingw32 package only in dist trusty.
Silvio Traversaro 008df693 2020-11-26T11:16:05 Merge pull request #85 from rhabacker/cmake-wine-support Add support to use wine to run cross compiled tests for cmake
Ralf Habacker 49c3a337 2020-11-03T14:43:41 cmake: Keep warning in sync with Makefile based build system
Ralf Habacker 90302fc5 2020-11-03T10:05:33 Add cmake building support to Travis CI To make it easier to extend the CI support and to be able to execute the contained tests locally, a dedicated shell script tools/ci_build.sh was added to execute the tests.
Ralf Habacker 2821345e 2020-11-02T13:06:55 cmake: add option ENABLE_WINE to enable support for running cross compiled tests with wine For details about the ENABLE_WINE option, which support three modes AUTO|ON|OFF see the documentation of cmake macro check_auto_option(). A custom path for the wine executable can be specified by adding -DWINE_EXECUTABLE=<path> to the cmake command line. The cmake related macros were copied from https://gitlab.freedesktop.org/dbus/dbus/-/blob/master/cmake/modules/Macros.cmake
Ralf Habacker 53b1d71a 2020-11-03T10:45:36 cmake: separate targets in tests subdir for reasier reading
Ralf Habacker 3292a137 2020-11-02T12:50:41 cmake: Let make target 'test' be accessable from topmost build directory The cmake command enable_testing() must be placed in the topmost CMakeLists.txt so that the make target 'test' is available in the topmost build directory.
Silvio Traversaro 0b899996 2020-11-08T11:48:21 Merge pull request #86 from pali/master Change order of variables in appveyor build matrix
Pali Rohár 214d5668 2020-11-04T18:12:50 Change order of variables in appveyor build matrix This change no function effect as it changes only order of defined variables. The only visible change is on appveyor web where variables are printed in other as they are defined. If list of variables is too long, variables defined later are hidden on the web interface. Variable APPVEYOR_BUILD_WORKER_IMAGE was moved to the end of list as it is less important to know as variable GENERATOR (defines which compiler is used).
Ralf Habacker 11c80b8e 2020-11-02T12:37:36 cmake: place all generated binaries into one place This is required for running test applications, because by default cmake places binaries into the associated subdir.
Silvio Traversaro d640d80f 2020-09-21T22:31:41 Merge pull request #79 from rhabacker/cmake-refactoring CMake build system fixes
Silvio Traversaro 33e2fdc2 2020-09-21T22:29:54 Merge pull request #82 from rhabacker/drop-obsolete-vcproj-files Drop obsolete visual studio related files
Ralf Habacker ff6060ba 2020-09-06T23:13:47 Drop obsolete visual studio related files These files can be easily recreated with cmake on the fly, which is already used by CI-system.
Ralf Habacker faa2ff80 2020-09-14T12:21:55 Makefile: Adjust paths of source files, which are now located in subdirectories
Ralf Habacker 218e7785 2020-08-25T23:24:25 Fix cmake warning 'No project() command is present'
Ralf Habacker f0ac8495 2020-08-25T23:34:19 Move cmake targets into sub directories
Ralf Habacker 5ead6f2d 2020-08-25T23:31:13 Update minimum required cmake version to 2.8.11 to simplify code According to https://cmake.org/pipermail/cmake/2013-May/054792.html cmake 2.8.11 was released in 2013, so we can assume that no older version will be used anymore.
Silvio Traversaro c5a5e6d5 2020-09-13T19:35:47 Merge pull request #81 from ramiropolla/master Relicense to MIT
Silvio Traversaro d240aff1 2020-09-13T19:26:54 Rephrase configure script copyright notice
Silvio Traversaro f601b05f 2020-09-13T19:11:46 Merge pull request #80 from pali/master Add Travis CI testing
Ramiro Polla 4583f267 2020-08-30T13:43:50 Relicense to MIT The licensing note in the configure script has been reworked, similarly to how libvpx did it (they were also based on FFmpeg's configure script and also use a more permissive license).
Pali Rohár 48d16ae0 2020-08-26T19:27:28 Add Travis CI testing
Silvio Traversaro e5d9fab4 2020-08-05T08:50:41 Merge pull request #76 from pali/master Fix compilation with older environments
Pali Rohár e1d593d9 2020-08-04T18:35:01 Fix compilation with older environments This change should fix following compile error: dlfcn.c: In function 'dlsym': dlfcn.c:374:14: warning: implicit declaration of function 'GetModuleHandleExA' dlfcn.c: undefined reference to `GetModuleHandleExA' Documentation for function GetModuleHandleExA() says: To compile an application that uses this function, define _WIN32_WINNT as 0x0501 or later. Fixes: https://github.com/dlfcn-win32/dlfcn-win32/issues/75
Silvio Traversaro 0a494c01 2020-07-15T08:07:53 Merge pull request #74 from pali/master Replace VirtualQueryEx() call by GetModuleHandleExA() call
Pali Rohár 8ec5ffef 2020-07-14T21:14:56 Replace VirtualQueryEx() call by GetModuleHandleExA() call Usage of VirtualQueryEx() call is needed for retrieving HMODULE of passed function address and it is just an undocumented hack. Based on @rhabacker's tests it is unstable and does not work correctly. https://github.com/dlfcn-win32/dlfcn-win32/pull/72#issuecomment-656581418 So replace VirtualQueryEx() call by standard GetModuleHandleExA() function with special GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS flag which should do the same thing but it is documented and it is working correctly.
Silvio Traversaro 61ad60f5 2020-03-24T16:54:12 Merge pull request #69 from reborn2266/fix_mmleak fix memory leak in dlsym()
Mars Cheng cea65639 2020-03-24T20:05:29 fix memory leak in dlsym()
Silvio Traversaro 32be0765 2020-02-22T13:54:54 Merge pull request #68 from pali/master Show "(null)" in error message when passed filname to dlopen() was NULL and error occurred
Pali Rohár 70c5c20a 2020-02-19T22:39:29 Show "(null)" in error message when passed filname to dlopen() was NULL and error occurred It does not make sense to pass file variable (which is NULL) to function save_err_ptr_str() which converts its argument to string. We can call directly save_err_str() with string value. Also it is highly unexpected that GetModuleHandle(NULL) call fails.
Silvio Traversaro 974b39c7 2019-10-13T09:43:21 Merge pull request #67 from pali/master Add test which check that dlopen() can open same files as open()
Pali Rohár ab246dbf 2019-09-12T16:37:03 Add test which check that dlopen() can open same files as open() This ensures that dlopen() expects filenames encoded in same codepage as WinAPI's open() function.
Silvio Traversaro 07ef52a5 2019-09-01T14:35:56 Merge pull request #65 from pali/master Update documentation in dlfcn.h, specially for RTLD_LAZY
Pali Rohár 5d576e6d 2019-08-29T21:07:32 Update documentation in dlfcn.h, specially for RTLD_LAZY
Silvio Traversaro e7fef1b5 2019-08-23T10:19:56 Merge pull request #63 from pali/master Makefile: Fix building both static and shared library at the same time
Pali Rohár 2b342400 2019-08-22T23:36:22 Makefile: Fix building both static and shared library at the same time Static library libdl.a must be build without -DSHARED flag for obvious reason. So -DSHARED cannot be in global CFLAGS. Define also two separate test targets: test.exe for shared library and test-static.exe for static library.
Silvio Traversaro 1dfd103a 2019-08-22T23:05:54 Merge pull request #62 from pali/master Reduce memory usage by 64K
Pali Rohár 588b5782 2019-08-22T17:25:11 Reduce memory usage by 64K One buffer for error message is enough.
Silvio Traversaro 7f1a5e55 2019-08-21T10:48:49 Merge pull request #59 from pali/master Fix compile warnings
Pali Rohár ff302674 2019-07-26T18:21:30 Fix more gcc warnings ISO C90 forbids mixed declarations and code ISO C++ forbids converting a string constant to 'char*'
Pali Rohár 2bb5f487 2019-07-25T20:34:46 Fix gcc warning: ISO C forbids return between function pointer and void * Instead of using compiler specific pragma to disable particular warning, rewrite code which cast from function pointer to data pointer according to POSIX dlopen() documentation. This also fix compile warning under MSVC. According to the ISO C standard, casting between function pointers and 'void *', as done above, produces undefined results. POSIX.1-2003 and POSIX.1-2008 accepted this state of affairs and proposed the following workaround: *(void **) (&cosine) = dlsym(handle, "cos"); This (clumsy) cast conforms with the ISO C standard and will avoid any compiler warnings.
Pali Rohár 403b240f 2019-07-25T20:34:28 Fix gcc warning: comparison between signed and unsigned integer expressions GetTempPathA() returns DWORD (32/64bit unsigned integer) and not int (32 signed integer).
Pali Rohár 39ff58c2 2019-07-25T20:32:53 Do not include intrin.h file Include file intrin.h is not needed for compiling dlfcn.c as _ReturnAddress intrinsic is defined in dlfcn.c manually. Moreover _ReturnAddress is available only as an intrinsic, there is no function implementation. So even including intrin.h file does not provide function variant for _ReturnAddress. More important, include file intrin.h is not available in older Windows Driver Kit 7.1.0. So removing usage of intrin.h file makes compilation of dlfcn-win32 also under these older WDK versions.
Silvio Traversaro e476c014 2019-07-25T16:59:14 Merge pull request #58 from pali/master Correctly process malloc() error in dlsym()
Pali Rohár 242b94ac 2019-07-24T23:06:57 Correctly process malloc() error in dlsym() malloc() may fail, so propagate this error to caller.
Silvio Traversaro 4e17b083 2019-07-23T18:00:04 Merge pull request #55 from pali/master Turn off GUI error messages around LoadLibraryA also in test
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