diff options
| author | 2026-11-25 15:31:30 +0100 | |
|---|---|---|
| committer | 2026-11-25 15:31:30 +0100 | |
| commit | a7c6a134fec64be56bf689032d0487f728e22d84 (patch) | |
| tree | b85edbc1cfcbd34a7102ca116c98dea396608ae2 | |
| parent | 60bf03b4cac8ed5f52f803cdb031a404c0da3beb (diff) | |
| download | libimobiledevice-a7c6a134fec64be56bf689032d0487f728e22d84.tar.gz libimobiledevice-a7c6a134fec64be56bf689032d0487f728e22d84.tar.bz2 | |
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/libimobiledevice/libimobiledevice.h | 8 | ||||
| -rw-r--r-- | src/idevice.h | 6 |
2 files changed, 6 insertions, 8 deletions
diff --git a/include/libimobiledevice/libimobiledevice.h b/include/libimobiledevice/libimobiledevice.h index bc57778..86a419d 100644 --- a/include/libimobiledevice/libimobiledevice.h +++ b/include/libimobiledevice/libimobiledevice.h @@ -39,13 +39,7 @@ typedef SSIZE_T ssize_t; #endif #ifndef LIBIMOBILEDEVICE_API - #ifdef LIBIMOBILEDEVICE_STATIC - #define LIBIMOBILEDEVICE_API - #elif defined(_WIN32) - #define LIBIMOBILEDEVICE_API __declspec(dllimport) - #else - #define LIBIMOBILEDEVICE_API - #endif + #define LIBIMOBILEDEVICE_API #endif /** Error Codes */ diff --git a/src/idevice.h b/src/idevice.h index e05338e..c3fa55f 100644 --- a/src/idevice.h +++ b/src/idevice.h @@ -40,7 +40,11 @@ #ifdef LIBIMOBILEDEVICE_STATIC #define LIBIMOBILEDEVICE_API #elif defined(_WIN32) - #define LIBIMOBILEDEVICE_API __declspec( dllexport ) + #ifdef DLL_EXPORT + #define LIBIMOBILEDEVICE_API __declspec( dllexport ) + #else + #define LIBIMOBILEDEVICE_API + #endif #else #if __GNUC__ >= 4 #define LIBIMOBILEDEVICE_API __attribute__((visibility("default"))) |
