Skip to content

Commit 93ebfe8

Browse files
real-or-randomhebasto
authored andcommitted
build: Add extensive docs on visibility issues
1 parent 7dc79e5 commit 93ebfe8

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

include/secp256k1.h

Lines changed: 9 additions & 1 deletion
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.
@@ -154,8 +160,10 @@ typedef int (*secp256k1_nonce_function)(
154160
#endif
155161
#ifndef SECP256K1_API
156162
# if defined(__GNUC__) && (__GNUC__ >= 4) && defined(SECP256K1_BUILD)
163+
/* Building libsecp256k1 on non-Windows using GCC or compatible. */
157164
# define SECP256K1_API __attribute__ ((visibility ("default")))
158165
# else
166+
/* All cases not captured above. */
159167
# define SECP256K1_API
160168
# endif
161169
#endif

0 commit comments

Comments
 (0)