Skip to content

Commit bdcd794

Browse files
real-or-randomhebasto
authored andcommitted
build: Add extensive docs on visibility issues
1 parent 94c5485 commit bdcd794

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

include/secp256k1.h

+9-1
Original file line numberDiff line numberDiff line change
@@ -133,8 +133,14 @@ typedef int (*secp256k1_nonce_function)(
133133
# define SECP256K1_NO_BUILD
134134
#endif
135135

136-
/* Symbol visibility. See https://gcc.gnu.org/wiki/Visibility */
136+
/* Symbol visibility. */
137137
#if defined(_WIN32)
138+
/* GCC for Windows (e.g., MinGW) accepts the __declspec syntax
139+
* for MSVC compatibility. A __declspec declaration implies (but is not
140+
* exactly equivalent to) __attribute__ ((visibility("default"))), and so we
141+
* actually want __declspec even on GCC, see "Microsoft Windows Function
142+
* Attributes" in the GCC manual and the recommendations in
143+
* https://gcc.gnu.org/wiki/Visibility. */
138144
# if defined(SECP256K1_BUILD)
139145
# if defined(DLL_EXPORT) || defined(SECP256K1_DLL_EXPORT)
140146
/* Building libsecp256k1 as a DLL.
@@ -151,8 +157,10 @@ typedef int (*secp256k1_nonce_function)(
151157
#endif
152158
#ifndef SECP256K1_API
153159
# if defined(__GNUC__) && (__GNUC__ >= 4) && defined(SECP256K1_BUILD)
160+
/* Building libsecp256k1 on non-Windows using GCC or compatible. */
154161
# define SECP256K1_API extern __attribute__ ((visibility ("default")))
155162
# else
163+
/* All cases not captured above. */
156164
# define SECP256K1_API extern
157165
# endif
158166
#endif

0 commit comments

Comments
 (0)