Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: 45839th attempt to fix symbol visibility on Windows #1595

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions include/secp256k1.h
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,15 @@ typedef int (*secp256k1_nonce_function)(
* 1. If using Libtool, it defines DLL_EXPORT automatically.
* 2. In other cases, SECP256K1_DLL_EXPORT must be defined. */
# define SECP256K1_API extern __declspec (dllexport)
# else
/* Building libsecp256k1 as a static library on Windows.
Copy link
Member

@hebasto hebasto Oct 16, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Referencing the use of a static library does not apply to our cases with the tests and noverify_tests targets using CMake, where object files are linked directly.

Copy link
Contributor Author

@real-or-random real-or-random Oct 17, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You mean https://github.com/bitcoin-core/secp256k1/blob/master/src/CMakeLists.txt#L89, right? True, and it's also true for bench_internal and bench_ecmult.

Would you prefer "Building libsecp256k1 not as a DLL."? (I also dropped the Windows part because it's anyway only Windows in the outer #ifdef.)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You mean https://github.com/bitcoin-core/secp256k1/blob/master/src/CMakeLists.txt#L89, right? True, and it's also true for bench_internal and bench_ecmult.

Would you prefer "Building libsecp256k1 not as a DLL."? (I also dropped the Windows part because it's anyway only Windows in the outer #ifdef.)

Looks good. However, I'm not sure if it worth invalidating all ACKs.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. However, I'm not sure if it worth invalidating all ACKs.

Ok, let's just get it merged.

* No declspec is needed, and so we would want the non-Windows-specific
* logic below take care of this case. However, this may result in setting
* __attribute__ ((visibility("default"))), which is supposed to be a noop
* on Windows but may trigger warnings when compiling with -flto due to a
* bug in GCC, see
* https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116478 . */
# define SECP256K1_API extern
# endif
/* The user must define SECP256K1_STATIC when consuming libsecp256k1 as a static
* library on Windows. */
Expand All @@ -156,11 +165,12 @@ typedef int (*secp256k1_nonce_function)(
# endif
#endif
#ifndef SECP256K1_API
/* All cases not captured by the Windows-specific logic. */
# if defined(__GNUC__) && (__GNUC__ >= 4) && defined(SECP256K1_BUILD)
/* Building libsecp256k1 on non-Windows using GCC or compatible. */
/* Building libsecp256k1 using GCC or compatible. */
# define SECP256K1_API extern __attribute__ ((visibility ("default")))
# else
/* All cases not captured above. */
/* Fall back to standard C's extern. */
# define SECP256K1_API extern
# endif
#endif
Expand Down
Loading