Skip to content

Commit 297c85a

Browse files
build: Add #ifdefs for requesting import as DLL vs static explicitly
1 parent 85aecf4 commit 297c85a

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

include/secp256k1.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,11 +136,20 @@ typedef int (*secp256k1_nonce_function)(
136136
/* Symbol visibility. See https://gcc.gnu.org/wiki/Visibility */
137137
/* DLL_EXPORT is defined internally for shared builds */
138138
#if defined(_WIN32) || defined(__CYGWIN__)
139+
# if defined(SECP256K1_STATICLIB) && defined(SECP256K1_DLL)
140+
# error "At most one of SECP256K1_STATICLIB and SECP256K1_DLL must be defined."
141+
# endif
139142
# ifdef SECP256K1_BUILD
140143
# ifdef DLL_EXPORT
141144
# define SECP256K1_API __declspec (dllexport)
142145
# define SECP256K1_API_VAR extern __declspec (dllexport)
143146
# endif
147+
# elif defined(SECP256K1_STATICLIB)
148+
# define SECP256K1_API
149+
# define SECP256K1_API_VAR extern
150+
# elif defined(SECP256K1_DLL)
151+
# define SECP256K1_API __declspec (dllimport)
152+
# define SECP256K1_API_VAR extern __declspec (dllimport)
144153
# elif defined _MSC_VER
145154
# define SECP256K1_API
146155
# define SECP256K1_API_VAR extern __declspec (dllimport)

0 commit comments

Comments
 (0)