-
Notifications
You must be signed in to change notification settings - Fork 373
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
"Shared" example not working on Windows/MinGW #245
Comments
Your bug report is very good! I'll check this issue. |
Unfortunately MinGW doesn't play well with exporting/importing classes and inline functions (and they should be inline as they are in headers). I don't see an easy way to fix this. However you can achieve the similar functionality with the Chained example. Related issues that have interesting details: |
Thanks for looking into this, really appreciate it. Looks like the chained example will work fine for my needs, so can use that instead. Might be worth adding a note in the readme that sharing the log instance across libs won't work properly in MinGW. |
The example provided in
Shared
does not work correctly when built with GCC using MinGW64 - the log output from the two shared libraries is never printed.I've attempted to provide some instructions on how to reproduce, let me know if you have any issues.
Steps to Reproduce
If you don't have a MinGW environment;
pacman -S mingw-w64-x86_64-cmake mingw-w64-x86_64-gcc mingw-w64-x86_64-ninja
Now build and run the sample
SharedApp/main.cpp
to renameSharedLib1.dll
andSharedLib2.dll
in theLoadLibraryW
calls tolibSharedLib1.dll
andlibSharedLib2.dll
(since cmake will prefix dll names with lib in this environment)The log messages from the two libraries is missing
Expected Behaviour
The shared libraries will import the Plog instance and print the expected log messages
Notes
Check the exported symbols from SharedApp.exe with Dependencies (https://github.com/lucasg/Dependencies), we can see SharedApp.exe does export the plog symbols:
So the symbols are correctly being exported, but the shared libraries are not importing them correctly.
Calling
plog::Logger<0>::getInstance();
in one of the shared libraries returns a null pointer.Environment
d60df3a1efa99061f637c263fe4e467c273d8655
The text was updated successfully, but these errors were encountered: