entityx icon indicating copy to clipboard operation
entityx copied to clipboard

Shared library not working in Windows

Open memsharded opened this issue 3 years ago • 1 comments

EntityX is in ConanCenter: https://conan.io/center/entityx

But the shared library build has been removed for Windows: https://github.com/conan-io/conan-center-index/blob/ff8bf5423a93bd972099a16f2a7b2646d53b7f69/recipes/entityx/all/conanfile.py#L52

Removing those lines, the output shows as the result of CMake install:

-- Install configuration: "Release"
  -- Installing: C:/.../lib/pkgconfig/entityx.pc
  -- Installing: C:/.../include/entityx
  -- Installing: C:/.../include/entityx/deps
  -- Installing: C:/.../include/entityx/deps/Dependencies.h
...
  -- Installing: C:/.../include/entityx/System.h
  -- Installing: C:/.../include/entityx/tags
  -- Installing: C:/.../include/entityx/tags/TagsComponent.h
  -- Installing: C:/.../bin/entityx.dll

Further inspection shows that the .lib static library is not being created at all. The ENTITYX_BUILD_SHARED is being defined.

Is this intended behavior? I can see that shared libraries are working fine in other platforms, is shared .dll library support for Windows? Thanks!

memsharded avatar Mar 26 '21 15:03 memsharded

It appears that the issue is (in part) that the code does not mark any classes or functions to be exported with __declspec(dllexport), so no .lib file is produced by MSVC to link against. Brute-forcing it with set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) seems to mitigate but not solve the problem, as only pool_test and tags_component_test are able to compile, link, and run. The rest appear to require more work to link as a shared library in Windows. There may be issues around the usage of STL types, but I'm not certain.

Deledrius avatar Jun 25 '21 07:06 Deledrius