-
Notifications
You must be signed in to change notification settings - Fork 123
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
Building on Win32 / Visual Studio generates a .dll with no exports #57
Comments
Actually it's not mandatory to build shared library, and it's easiler to go with the header-only way: just include fmtlog-inl.h in any of your source files and no library is needed. |
Sure! But the fmtlog-shared target in CMakeLists.txt is not flaged by an option() that would be enabled by some -D flag in cmake. If this target is not usable with MSVC may be it should not be enabled/built by default ? Because then it looks as some linker/config error mad it have no exports... only when reading the actual code does one understand that it can't have exports. Or add the FMTLOG_API/FMT_EXPORTS classif stuff in MSVC ? Then when upgrading fmtlog one could choose to only rebuild the DLL. Header only libraries are very useful for sure, but then one must rebuild all targets when upgrading (I already have to do this with inja, nlohmann/json, flatbuffers, etc.) |
For the header only version, actually fmtlog has two files: |
Even with old-fashioned typical DLLs whose headers contained only function signatures and data structures you always need to rebuild all dependent targets when DLL libraries were upgraded because any of those structures or signatures may have changed with a new DLL release. In rare cases you could get away without rebuilding your targets, typically with C libraries, if you looked up exported functions, but with C++ libraries you pretty much have to rebuild your targets or you'd be seeing all sorts of binary compatibility issues. A |
Agreed, but
Header-only fmtlog is fine for me. |
These macros capture logger's locations in any setting where the logger is implemented as a separate component, which is typical for server-type applications. Consider an application that has multiple DLLs, all need to log. If A solution to this would be to have a logger DLL, which uses
Dropping in a new DLL may work for internal builds, but a security release from another project will have a different patch number, so you would have to be mindful of their recommendations whether it changes the interface in terms of binary compatibility. In rare special cases you can advise your production guys or app users to drop in a fixed DLL, but in most cases getting a new set of headers, import libraries and DLLs means your CI/CD pipeline runs and produces a new package, so you have to test it anyway. How much, is another question.
It is intended for Linux builds. The |
Hi!
I succesfuly built fmtlog with CMake on a Windows 10 box, with CMake 3.25.0 and Visual Studio 2019.
Targets fmtlog-static.lib and fmtlog-shared.dll are generated.
Tests targets enc_dec_test.exe, log_test.exe, multithread_test.exe are generated linking against the static library.
But:
fmtlog-shared.dll has no exported symbols, because they are actually not exported i.e. no FMTLOG_API that resolves to __declspec(dllimport) / __declspec(dllexport), with some FMTLOG_EXPORTS compile symbol defined when building the DLL.
(So there is no fmtlog-shared.lib because no symbol is exported)
I know... Stupid Windows linker, GNU ld does not need this...
The text was updated successfully, but these errors were encountered: