When building highway 1.2.0 on Windows using MinGW-w64 the shared build fails with the following error:
hwy/contrib/thread_pool/topology.cc:67:20: error: function 'bool hwy::HaveThreadingSupport()' definition is marked dllimport
When looking at this section in hwy/highway_export.h:
#if !defined(HWY_SHARED_DEFINE)
#define HWY_DLLEXPORT
#define HWY_CONTRIB_DLLEXPORT
#define HWY_TEST_DLLEXPORT
#else // !HWY_SHARED_DEFINE
#ifndef HWY_DLLEXPORT
#if defined(hwy_EXPORTS)
/* We are building this library */
#ifdef _WIN32
#define HWY_DLLEXPORT __declspec(dllexport)
#else
#define HWY_DLLEXPORT __attribute__((visibility("default")))
#endif
...
and this section in CMakeLists.txt:
if("${HWY_LIBRARY_TYPE}" STREQUAL "SHARED")
set(DLLEXPORT_TO_DEFINE "HWY_SHARED_DEFINE")
else()
set(DLLEXPORT_TO_DEFINE "HWY_STATIC_DEFINE")
endif()
it's clear that set(DLLEXPORT_TO_DEFINE "HWY_SHARED_DEFINE") causes HWY_DLLEXPORT to be defined as nothing instead of __declspec(dllexport).
I was able to build successfully after changing CMakeLists.txt so HWY_SHARED_DEFINE is not defined.
When building highway 1.2.0 on Windows using MinGW-w64 the shared build fails with the following error:
When looking at this section in
hwy/highway_export.h:and this section in
CMakeLists.txt:it's clear that
set(DLLEXPORT_TO_DEFINE "HWY_SHARED_DEFINE")causesHWY_DLLEXPORTto be defined as nothing instead of__declspec(dllexport).I was able to build successfully after changing
CMakeLists.txtsoHWY_SHARED_DEFINEis not defined.