summaryrefslogtreecommitdiffstats
path: root/src/common.h
diff options
context:
space:
mode:
authorGravatar Nikias Bassen2026-11-25 15:21:43 +0100
committerGravatar Nikias Bassen2026-11-25 15:21:43 +0100
commitbdf48cf4b567b05f73f8f2ed0c05735d2a4d0899 (patch)
treea26ba6c4263165c25e787c438b395fb0198c7563 /src/common.h
parent420053a5fc536062014a121e14d847db914be999 (diff)
downloadlibimobiledevice-glue-bdf48cf4b567b05f73f8f2ed0c05735d2a4d0899.tar.gz
libimobiledevice-glue-bdf48cf4b567b05f73f8f2ed0c05735d2a4d0899.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.
Diffstat (limited to 'src/common.h')
-rw-r--r--src/common.h6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/common.h b/src/common.h
index 2916039..9b01cad 100644
--- a/src/common.h
+++ b/src/common.h
@@ -28,7 +28,11 @@
#ifdef LIMD_GLUE_STATIC
#define LIMD_GLUE_API
#elif defined(_WIN32)
- #define LIMD_GLUE_API __declspec( dllexport )
+ #ifdef DLL_EXPORT
+ #define LIMD_GLUE_API __declspec( dllexport )
+ #else
+ #define LIMD_GLUE_API
+ #endif
#else
#if __GNUC__ >= 4
#define LIMD_GLUE_API __attribute__((visibility("default")))