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 <redacted>
*/
/* 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
/*