Building tests on Windows fails with `BUILD_SHARED_LIBS=ON`
MiguelCompany opened this issue · 3 comments
MiguelCompany commented
Build fails with an unresolved external error:
default_allocator.obj : error LNK2001: unresolved external symbol "unsigned __int64 const foonathan::memory::virtual_memory_page_size" (?virtual_memory_page_size@memory@foonathan@@3_KB)
I've seen you are setting CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS=ON
here, but note the following sentence, extracted from the CMake docs:
For global data symbols, __declspec(dllimport) must still be used when compiling against the code in the .dll.
It seems we need a __declspec(dllimport)
here
foonathan commented
I'm not using windows and have never used DLL's, so I'd appreciate a PR.
MiguelCompany commented
An easy but API-breaking solution would be to convert that extern const
into a method. That way, it will be automatically exported and imported.
Building the tests on the CI with BUILD_SHARED_LIBS
on and off would be enough to check everything works ok.
MiguelCompany commented
@foonathan Please check #132 for a possible fix!