Yep, yet another visiblity PR :)
Noticed this when building libbitcoinkernel for Linux. Core needs a way to link a static secp into a (shared or static) kernel without exporting the secp symbols.
autotools defines DLL_EXPORT
for dll builds. CMake mimics this behavior and defines SECP256K1_DLL_EXPORT
.
This means that currently Windows builds only export their symbols for shared libraries, and all other platforms export for shared AND static.
Unfortunately, there’s no way to make autotools define a special variable when building for other platforms.
CMake could define a variable for shared lib builds on all platforms, which the header could then use to decide whether or not to export symbols, but that would introduce a behavioral difference between the build-systems.
Instead, provide an escape hatch via SECP256K1_NO_EXPORTS
which can be used when building secp for non-Windows targets when exports are not desired (when building a static lib).