aboutsummaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* Fix resolving global symbols when LoadLibrary() is called after dlopen()Pali Rohár2019-02-146-112/+144
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 */
* Merge pull request #48 from dlfcn-win32/appveyor-mingw-take-twoSilvio Traversaro2019-02-141-5/+84
|\ | | | | Add MinGW and MinGW-w64 builds to AppVeyor (take 2)
| * Add MinGW and MinGW-w64 tests to AppVeyorSilvio Traversaro2019-02-121-5/+84
|/
* Merge pull request #41 from jddurand/masterv1.1.2Silvio Traversaro2018-03-081-0/+1
|\ | | | | #include <stdlib.h>
| * #include <stdlib.h>Jean-Damien Durand2018-01-171-0/+1
|/
* Merge pull request #40 from dlfcn-win32/document-cmake-usageSilvio Traversaro2017-09-271-0/+24
|\ | | | | Document how to use the library when using CMake
| * Mention the possibility of defining CMAKE_DL_LIBSSilvio Traversaro2017-08-241-0/+13
| |
| * Document how to use the library when using CMakeSilvio Traversaro2017-08-241-0/+11
|/
* Merge pull request #39 from dlfcn-win32/traversaro-patch-2Silvio Traversaro2017-05-041-1/+1
|\ | | | | [README] Fix AppVeyor badge
| * [README] Fix AppVeyor badgeSilvio Traversaro2017-05-041-1/+1
|/
* Merge pull request #38 from dlfcn-win32/appveyor-test-vs2017v1.1.1Silvio Traversaro2017-05-041-6/+16
|\ | | | | [appveyor] Test the library using Visual Studio 15 2017
| * [appveyor] Test the library using Visual Studio 15Silvio Traversaro2017-05-011-6/+16
| | | | | | See https://www.appveyor.com/docs/build-environment/ for the logic behind the option used.
* | Merge pull request #36 from dlfcn-win32/fix-dlerrorSilvio Traversaro2017-05-042-0/+21
|\ \ | |/ |/| Fix bug in dlerror second consecutive call
| * Fix bug in dlerror second consecutive callSilvio2017-05-012-0/+21
|/ | | | | | | | | | | | | 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.
* Merge pull request #30 from Kamekameha/appveyor-fixSilvio Traversaro2017-04-091-16/+16
|\ | | | | Minor AppVeyor configuration cleanup
| * Minor AppVeyor configuration cleanupKamekameha2017-03-191-16/+16
|/
* [readme] Update AppVeyor badgeSilvio Traversaro2017-03-191-1/+1
|
* Merge pull request #29 from traversaro/add-appveyorv1.1.0Silvio Traversaro2017-03-104-8/+99
|\ | | | | Fix tests in Visual Studio 2015 and add AppVeyor support
| * Add testing of CMake exported targetsSilvio2017-03-053-1/+27
| |
| * Add AppVeyor badgeSilvio Traversaro2017-03-051-1/+1
| |
| * Add appveyor supportSilvio Traversaro2017-03-051-0/+63
| |
| * Fix tests in Visual Studio 2015Silvio2017-03-051-7/+9
|/ | | | | | | | 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.
* Merge pull request #27 from traversaro/add-cmake-config-fileSilvio Traversaro2017-03-052-2/+46
|\ | | | | Add CMake code to export a CMake config file
| * Add CMake code to export a CMake config fileSilvio2016-12-272-2/+46
|/
* configure: put test.{c,dll} to current directory (#26)Boris Nagaev2016-07-253-4/+12
| | | | | instead of /tmp/ to avoid races when building for multiple targets. Add test files to .gitignore and `make clean`.
* Merge pull request #25 from xantares/patch-1Timothy Gu2016-03-231-5/+1
|\ | | | | Removed wine detection
| * Removed wine detectionxantares2016-03-231-5/+1
|/ | | It can be set canonically by using CMAKE_CROSSCOMPILIING_EMULATOR variable
* Merge pull request #20 from robertwgh/unicodeTimothy Gu2015-08-061-22/+90
|\ | | | | Added support for unicode character set.
| * Added support for unicode character set.Guohui Wang2015-04-091-22/+90
|/
* Update README.mdTimothy Gu2015-04-061-1/+9
| | | Fixes #18.
* Add my copyrightTimothy Gu2015-03-151-0/+1
| | | Not that I care…
* Warning control in MSVCTimothy Gu2015-03-152-3/+8
|
* Revert "Use level 4 warnings for Visual Studio"Timothy Gu2015-03-151-8/+8
| | | | This reverts commit 77a6dfd8c588a64300ea380bf32256da3b93f1ef.
* Use SHARED macro to handle DLL exportTimothy Gu2015-03-151-0/+2
| | | | | | | (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.
* Merge branch 'global-loaded-mods'Timothy Gu2015-03-157-43/+195
|\ | | | | | | Closes #9.
| * Add linked modules to a separate global listTimothy Gu2015-03-157-43/+186
| | | | | | | | Fixes #2.
| * Define SHARED when building shared libraryTimothy Gu2015-03-153-0/+9
|/
* Check for memory leak when _DEBUG is definedTimothy Gu2015-03-153-0/+27
|
* Use level 4 warnings for Visual StudioTimothy Gu2015-03-153-26/+26
|
* Merge pull request #10 from xantares/patch-5Timothy Gu2015-03-111-2/+6
|\ | | | | set CMAKE_BUILD_TYPE default
| * set CMAKE_BUILD_TYPE defaultxantares2015-03-121-2/+6
|/ | | it's used to set release flags
* Add static **configurations**Timothy Gu2015-03-115-1/+345
|
* Revert "Add a static solution"Timothy Gu2015-03-117-517/+0
| | | | This reverts commit 22dd588b852abd5a8de6cd09aa5c876883435ecd.
* Add a static solutionTimothy Gu2015-03-117-0/+517
|
* Do not use dllimport in any caseTimothy Gu2015-03-111-2/+2
|
* Add Visual Studio 12 filesTimothy Gu2015-03-117-0/+517
| | | | CMake sucks.
* Add import/export symbols for MSVC.Dennis Nienhüser2015-03-112-4/+11
| | | | | | | | | | 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>
* Use more secure sprintf_s()Timothy Gu2015-03-111-1/+1
|
* Don't ignore VS filesTimothy Gu2015-03-111-5/+0
|
* Add .gitignoreTimothy Gu2015-03-111-0/+238
|