From fec1d79ee5ff7def2d2208767fb31ce5978f587c Mon Sep 17 00:00:00 2001 From: Nikias Bassen Date: Mon, 29 Jan 2024 05:41:49 +0100 Subject: Fix IRECV_API definitions --- configure.ac | 5 +++++ include/libirecovery.h | 14 ++++---------- src/libirecovery.c | 12 ++++++++++++ 3 files changed, 21 insertions(+), 10 deletions(-) diff --git a/configure.ac b/configure.ac index 2b12d8f..fdecca3 100644 --- a/configure.ac +++ b/configure.ac @@ -141,6 +141,11 @@ AS_IF([test "x$with_dummy" = "xyes"], [ ]) AS_COMPILER_FLAGS(GLOBAL_CFLAGS, "-Wall -Wextra -Wmissing-declarations -Wredundant-decls -Wshadow -Wpointer-arith -Wwrite-strings -Wswitch-default -Wno-unused-parameter -fvisibility=hidden") + +if test "x$enable_static" = "xyes" -a "x$enable_shared" = "xno"; then + GLOBAL_CFLAGS+=" -DIRECV_STATIC" +fi + AC_SUBST(GLOBAL_CFLAGS) AC_SUBST(GLOBAL_LDFLAGS) diff --git a/include/libirecovery.h b/include/libirecovery.h index 9909f04..f6b9971 100644 --- a/include/libirecovery.h +++ b/include/libirecovery.h @@ -27,17 +27,11 @@ extern "C" { #include -#ifdef IRECV_STATIC - #define IRECV_API -#elif defined(_WIN32) - #ifdef DLL_EXPORT - #define IRECV_API __declspec(dllexport) - #else +#ifndef IRECV_API + #ifdef IRECV_STATIC + #define IRECV_API + #elif defined(_WIN32) #define IRECV_API __declspec(dllimport) - #endif -#else - #if __GNUC__ >= 4 - #define IRECV_API __attribute__((visibility("default"))) #else #define IRECV_API #endif diff --git a/src/libirecovery.c b/src/libirecovery.c index 9742cb5..e38cdd6 100644 --- a/src/libirecovery.c +++ b/src/libirecovery.c @@ -57,6 +57,18 @@ #endif #endif +#ifdef IRECV_STATIC + #define IRECV_API +#elif defined(_WIN32) + #define IRECV_API __declspec( dllexport ) +#else + #if __GNUC__ >= 4 + #define IRECV_API __attribute__((visibility("default"))) + #else + #define IRECV_API + #endif +#endif + #include "libirecovery.h" struct irecv_client_private { -- cgit v1.1-32-gdbae