Skip to content

Conversation

fabiocannizzo
Copy link

This PR allows to use and link the library both in Linux and Windows (also compatible with MSVC).

It exports most of the functions using a extern-C api, so there are no issue with inconsistent name mangling used by different compilers. Exceptions and memory allocations do not cross the shared library boundary, avoiding possible inconsistency of binary API.

When the target is Windows, the compiler of choice is clang with mingw. Compiling with gcc is not a viable option because of a long standing bug related to alignment of objects requiring 32-bytes alignment (see mingw-w64/mingw-w64#115). The generated DLL is self-contained, i.e. there are no other DLL dependencies (other than the kernel ones), so there is no need to distribute mingw toolchain DLLs.

The C++ standard is upgraded to C+20, which allows to use more portable version for the unlikely attribute.

There are a few more explicit uses of force inline. These are generally redundant, but, in some cases, they may help a bit when compiling for Windows platform, where by default AVX2 registers are not passed via registers.

Instructions on how to compile and available targets and cross compilation host platforms are in README.md.

A test file smoke.cpp to use the API is available in the make-c-api folder.

Github workflow files are also provided, to test various way to build the library and run the test.

This can be compiled for both Linux and Windows.
If the chosen target is a Windows DLL, the library is compatible with MSVC and
It is self-contained, i.e. there are no other DLL dependencies (other than the kernel) and
exceptions and memory allocations do not cross the DLL boundary.

Signed-off-by: Fabio Cannizzo <[email protected]>
…ments, to prevent registers spill to the stack in Windows ABI mode

Signed-off-by: Fabio Cannizzo <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant