rust-bitcoin / rust-secp256k1

Rust language bindings for Bitcoin secp256k1 library.
Creative Commons Zero v1.0 Universal
336 stars 252 forks source link

What does `SECP256K1_API` do? #680

Open tcharding opened 5 months ago

tcharding commented 5 months ago

Removing the define of this variable in build.rs doesn't seem to do anything. What does this var do?

Context

    // Actual build
    let mut base_config = cc::Build::new();
    base_config.include("depend/secp256k1/")
               .include("depend/secp256k1/include")
               .include("depend/secp256k1/src")
               .flag_if_supported("-Wno-unused-function") // some ecmult stuff is defined but not used upstream
               .flag_if_supported("-Wno-unused-parameter") // patching out printf causes this warning
               .define("SECP256K1_API", Some(""))
               .define("ENABLE_MODULE_ECDH", Some("1"))
               .define("ENABLE_MODULE_SCHNORRSIG", Some("1"))
               .define("ENABLE_MODULE_EXTRAKEYS", Some("1"))
               .define("ENABLE_MODULE_ELLSWIFT", Some("1"))
apoelstra commented 5 months ago

I'm surprised that the code compiles without that define. It erases the SECP256K1_API markers that appear in the libsecp header files, and which is used by the upstream build process to distinguish between exported and non-exported symbols.

I guess we could drop it since it only occurs in the header files, and we don't compile those..