status-im / nim-secp256k1

A wrapper for libsecp256k1
Apache License 2.0
7 stars 5 forks source link

Better default linkage #55

Closed yglukhov closed 3 months ago

yglukhov commented 5 months ago

SECP256K1_API are defined as __attribute__(visibility("default")), which might make sense compiling secp256k1 original as a dynamic library, but it makes less sense when it is wrapped in a nim library as it results in linker exporting all symbols marked with SECP256K1_API and SECP256K1_API_VAR, which in its turn prevents dead code elimination and grows the resulting binary size significantly (in case of wasm compilation it's ~ 1.5Mb). This PR introduces a better default, with an escape hatch (-d:secp256k1DefaultSymbolsExport).

yglukhov commented 3 months ago

My case turned out to be pretty specific, and I found a better workaround. Closing.