summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGerhard Sittig <gerhard.sittig@gmx.net>2022-02-14 20:35:05 +0100
committerGerhard Sittig <gerhard.sittig@gmx.net>2022-02-24 22:22:08 +0100
commit24ba9e1bdfe107e394176eda3116b714463a8437 (patch)
treecbd34738c21e30efeb2e737825ad6f6718b1ae25
parentda253ef59221744f7258720861638bd1ae2e335f (diff)
downloadlibsigrokdecode-24ba9e1bdfe107e394176eda3116b714463a8437.tar.gz
libsigrokdecode-24ba9e1bdfe107e394176eda3116b714463a8437.zip
libsigrokdecode.h: declare Windows dllexport for SRD_API routines
Add the __declspec(dllexport) decoration to SRD_API routines on Windows when building the library body (this is new). Stick with the default visibility on all other platforms (as previously implemented). This is similar to what Kyle Johnson submitted in PR 66, but phrased differently. Avoid the non-portable indentation before the hash in preprocessor instructions. Use positive logic for readability (put the Windows branch next to the check for the Windows platform). Reported-By: Kyle Johnson <KyleJ61782@gmail.com>
-rw-r--r--libsigrokdecode.h16
1 files changed, 10 insertions, 6 deletions
diff --git a/libsigrokdecode.h b/libsigrokdecode.h
index cf6479c..ea17cb8 100644
--- a/libsigrokdecode.h
+++ b/libsigrokdecode.h
@@ -106,17 +106,21 @@ enum srd_loglevel {
*/
/* Marks public libsigrokdecode API symbols. */
-#ifndef _WIN32
-#define SRD_API __attribute__((visibility("default")))
+#if defined _WIN32
+# if defined DLL_EXPORT
+# define SRD_API __declspec(dllexport)
+# else
+# define SRD_API extern
+# endif
#else
-#define SRD_API
+# define SRD_API __attribute__((visibility("default")))
#endif
/* Marks private, non-public libsigrokdecode symbols (not part of the API). */
-#ifndef _WIN32
-#define SRD_PRIV __attribute__((visibility("hidden")))
+#if defined _WIN32
+# define SRD_PRIV /* EMPTY */
#else
-#define SRD_PRIV
+# define SRD_PRIV __attribute__((visibility("hidden")))
#endif
/*