Fix symbol visibility across build triplets. Submitted upstream in https://github.com/P-H-C/phc-winner-argon2/pull/262 diff --git a/include/argon2.h b/include/argon2.h index 3980bb3..2738960 100644 --- a/include/argon2.h +++ b/include/argon2.h @@ -27,15 +27,29 @@ extern "C" { #endif /* Symbols visibility control */ -#ifdef A2_VISCTL -#define ARGON2_PUBLIC __attribute__((visibility("default"))) -#define ARGON2_LOCAL __attribute__ ((visibility ("hidden"))) -#elif _MSC_VER -#define ARGON2_PUBLIC __declspec(dllexport) -#define ARGON2_LOCAL +#if defined(_WIN32) + #if defined(A2_VISCTL) + #if defined(_MSC_VER) || defined(__MINGW32__) + #define ARGON2_PUBLIC __declspec(dllexport) + #else + #define ARGON2_PUBLIC __attribute__ ((dllexport)) + #endif + #else + #if defined(_MSC_VER) || defined(__MINGW32__) + #define ARGON2_PUBLIC __declspec(dllimport) + #else + #define ARGON2_PUBLIC /*__attribute__ ((dllimport))*/ + #endif + #endif + #define ARGON2_LOCAL #else -#define ARGON2_PUBLIC -#define ARGON2_LOCAL + #if defined(A2_VISCTL) + #define ARGON2_PUBLIC __attribute__ ((visibility ("default"))) + #define ARGON2_LOCAL __attribute__ ((visibility ("hidden"))) + #else + #define ARGON2_PUBLIC + #define ARGON2_LOCAL + #endif #endif /*