summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Nikias Bassen2026-11-25 15:24:33 +0100
committerGravatar Nikias Bassen2026-11-25 15:24:33 +0100
commitc8a2ea1308e404674563b440545a3167b23be923 (patch)
treef706d936a5e727502c77751fa7a3c49c874279a3
parent77fb90740c1613d37fa46ec77f4ab938aef9381d (diff)
downloadlibideviceactivation-c8a2ea1308e404674563b440545a3167b23be923.tar.gz
libideviceactivation-c8a2ea1308e404674563b440545a3167b23be923.tar.bz2
Windows: Don't use dllimport; only apply dllexport to DLL objects
Public headers declared the API macro as __declspec(dllimport) on Windows unless *_STATIC was defined. That made consumers reference __imp_<symbol>, which only exists in the DLL import library, so linking against the static library failed unless the consumer also defined *_STATIC. All exported symbols are functions, so dllimport is not needed: calls to plain symbols link against both the static library and the import library (via its thunks). Drop it from the public headers. On the library side, apply __declspec(dllexport) only when libtool defines DLL_EXPORT, i.e. when compiling the objects for the DLL. This keeps export directives out of the objects that go into the static library when both are built.
-rw-r--r--include/libideviceactivation.h8
-rw-r--r--src/activation.c6
2 files changed, 6 insertions, 8 deletions
diff --git a/include/libideviceactivation.h b/include/libideviceactivation.h
index dbee85b..4bc87d2 100644
--- a/include/libideviceactivation.h
+++ b/include/libideviceactivation.h
@@ -32,13 +32,7 @@ extern "C" {
#include <plist/plist.h>
#ifndef IDEVICE_ACTIVATION_API
- #ifdef IDEVICE_ACTIVATION_STATIC
- #define IDEVICE_ACTIVATION_API
- #elif defined(_WIN32)
- #define IDEVICE_ACTIVATION_API __declspec(dllimport)
- #else
- #define IDEVICE_ACTIVATION_API
- #endif
+ #define IDEVICE_ACTIVATION_API
#endif
typedef enum {
diff --git a/src/activation.c b/src/activation.c
index d3d7e74..1b14436 100644
--- a/src/activation.c
+++ b/src/activation.c
@@ -35,7 +35,11 @@
#ifdef IDEVICE_ACTIVATION_STATIC
#define IDEVICE_ACTIVATION_API
#elif defined(_WIN32)
- #define IDEVICE_ACTIVATION_API __declspec( dllexport )
+ #ifdef DLL_EXPORT
+ #define IDEVICE_ACTIVATION_API __declspec( dllexport )
+ #else
+ #define IDEVICE_ACTIVATION_API
+ #endif
#else
#if __GNUC__ >= 4
#define IDEVICE_ACTIVATION_API __attribute__((visibility("default")))