From bc7c8db179a56cf7273f3c4c0decd10543a10521 Mon Sep 17 00:00:00 2001
From: Cory Fields <cory-nospam-@coryfields.com>
Date: Thu, 4 May 2023 15:56:39 +0000
Subject: [PATCH] abi: Use dllexport for mingw builds

This should fix mingw exports, specifically hiding the following:
secp256k1_pre_g_128
secp256k1_pre_g
secp256k1_ecmult_gen_prec_table

This changes our visibility macros to look more like gcc's recommendation:
https://gcc.gnu.org/wiki/Visibility#How_to_use_the_new_C.2B-.2B-_visibility_support
---
 include/secp256k1.h | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/include/secp256k1.h b/include/secp256k1.h
index a7a2be7a3a..01d18cff09 100644
--- a/include/secp256k1.h
+++ b/include/secp256k1.h
@@ -133,8 +133,9 @@ typedef int (*secp256k1_nonce_function)(
 # define SECP256K1_NO_BUILD
 #endif
 
-/* Symbol visibility. See libtool manual, section "Windows DLLs". */
-#if defined(_WIN32) && !defined(__GNUC__)
+/* Symbol visibility. See https://gcc.gnu.org/wiki/Visibility */
+/* DLL_EXPORT is defined internally for shared builds */
+#if defined(_WIN32)
 # ifdef SECP256K1_BUILD
 #  ifdef DLL_EXPORT
 #   define SECP256K1_API            __declspec (dllexport)