aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/liblzma/api/lzma.h7
-rw-r--r--src/liblzma/check/crc32_x86.S7
-rw-r--r--src/liblzma/check/crc64_x86.S7
-rw-r--r--src/liblzma/common/common.h2
4 files changed, 14 insertions, 9 deletions
diff --git a/src/liblzma/api/lzma.h b/src/liblzma/api/lzma.h
index 97e02958..77032f3a 100644
--- a/src/liblzma/api/lzma.h
+++ b/src/liblzma/api/lzma.h
@@ -173,9 +173,12 @@
* to operating systems like Windows, or at least don't care about linking
* against static liblzma on them, don't worry about LZMA_API_STATIC. That
* is, most developers will never need to use LZMA_API_STATIC.
+ *
+ * Cygwin is a special case on Windows. We rely on GCC doing the right thing
+ * and thus don't use dllimport and don't specify the calling convention.
*/
#ifndef LZMA_API_IMPORT
-# if !defined(LZMA_API_STATIC) && defined(_WIN32)
+# if !defined(LZMA_API_STATIC) && defined(_WIN32) && !defined(__CYGWIN__)
# define LZMA_API_IMPORT __declspec(dllimport)
# else
# define LZMA_API_IMPORT
@@ -183,7 +186,7 @@
#endif
#ifndef LZMA_API_CALL
-# ifdef _WIN32
+# if defined(_WIN32) && !defined(__CYGWIN__)
# define LZMA_API_CALL __cdecl
# else
# define LZMA_API_CALL
diff --git a/src/liblzma/check/crc32_x86.S b/src/liblzma/check/crc32_x86.S
index b3c7538f..2342168b 100644
--- a/src/liblzma/check/crc32_x86.S
+++ b/src/liblzma/check/crc32_x86.S
@@ -76,7 +76,8 @@ init_table(void)
.text
.globl LZMA_CRC32
-#if !defined(__MACH__) && !defined(_WIN32) && !defined(__MSDOS__)
+#if !defined(__MACH__) && !defined(_WIN32) && !defined(__CYGWIN__) \
+ && !defined(__MSDOS__)
.type LZMA_CRC32, @function
#endif
@@ -275,8 +276,8 @@ LZMA_CRC32:
.indirect_symbol LZMA_CRC32_TABLE
.long 0
-#elif defined(_WIN32)
-# ifndef LZMA_API_STATIC
+#elif defined(_WIN32) || defined(__CYGWIN__)
+# ifdef DLL_EXPORT
/* This is equivalent of __declspec(dllexport). */
.section .drectve
.ascii " -export:lzma_crc32"
diff --git a/src/liblzma/check/crc64_x86.S b/src/liblzma/check/crc64_x86.S
index 5e170bc8..8b0a42db 100644
--- a/src/liblzma/check/crc64_x86.S
+++ b/src/liblzma/check/crc64_x86.S
@@ -66,7 +66,8 @@ init_table(void)
.text
.globl LZMA_CRC64
-#if !defined(__MACH__) && !defined(_WIN32) && !defined(__MSDOS__)
+#if !defined(__MACH__) && !defined(_WIN32) && !defined(__CYGWIN__) \
+ && !defined(__MSDOS__)
.type LZMA_CRC64, @function
#endif
@@ -258,8 +259,8 @@ LZMA_CRC64:
.indirect_symbol LZMA_CRC64_TABLE
.long 0
-#elif defined(_WIN32)
-# ifndef LZMA_API_STATIC
+#elif defined(_WIN32) || defined(__CYGWIN__)
+# ifdef DLL_EXPORT
/* This is equivalent of __declspec(dllexport). */
.section .drectve
.ascii " -export:lzma_crc64"
diff --git a/src/liblzma/common/common.h b/src/liblzma/common/common.h
index de252604..1fd778b0 100644
--- a/src/liblzma/common/common.h
+++ b/src/liblzma/common/common.h
@@ -17,7 +17,7 @@
#include "../../common/mythread.h"
#include "../../common/integer.h"
-#if !defined(LZMA_API_STATIC) && defined(_WIN32)
+#if defined(DLL_EXPORT) && (defined(_WIN32) || defined(__CYGWIN__))
# define LZMA_API_EXPORT __declspec(dllexport)
// Don't use ifdef or defined() below.
#elif HAVE_VISIBILITY