From 3306cf3883492720b3c34baa02f4eb4227d91c73 Mon Sep 17 00:00:00 2001 From: Lasse Collin Date: Sat, 7 Feb 2009 11:11:50 +0200 Subject: Introduced LZMA_API_STATIC macro, which the applications need to #define when linking against static liblzma on platforms like Windows. Most developers don't need to care about LZMA_API_STATIC at all. --- src/liblzma/api/lzma.h | 31 ++++++++++++++++++++++++------- src/liblzma/common/common.h | 2 +- 2 files changed, 25 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/liblzma/api/lzma.h b/src/liblzma/api/lzma.h index c03a19de..7cab3909 100644 --- a/src/liblzma/api/lzma.h +++ b/src/liblzma/api/lzma.h @@ -155,14 +155,31 @@ /* * Some systems require (or at least recommend) that the functions and - * function pointers are declared specially in the headers. + * function pointers are declared specially in the headers. LZMA_API_IMPORT + * is for importing symbols and LZMA_API_CALL is to specify calling + * convention. + * + * By default it is assumed that the application will link dynamically + * against liblzma. #define LZMA_API_STATIC in your application if you + * want to link against static liblzma. If you don't care about portability + * 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. */ -#ifdef _WIN32 -# define LZMA_API_IMPORT __declspec(dllimport) -# define LZMA_API_CALL __cdecl -#else -# define LZMA_API_IMPORT -# define LZMA_API_CALL +#ifndef LZMA_API_IMPORT +# if !defined(LZMA_API_STATIC) && defined(_WIN32) +# define LZMA_API_IMPORT __declspec(dllimport) +# else +# define LZMA_API_IMPORT +# endif +#endif + +#ifndef LZMA_API_CALL +# ifdef _WIN32 +# define LZMA_API_CALL __cdecl +# else +# define LZMA_API_CALL +# endif #endif #ifndef LZMA_API diff --git a/src/liblzma/common/common.h b/src/liblzma/common/common.h index cbb2eb9b..5a5fe775 100644 --- a/src/liblzma/common/common.h +++ b/src/liblzma/common/common.h @@ -24,7 +24,7 @@ #include "../../common/mythread.h" #include "../../common/integer.h" -#if defined(_WIN32) +#if !defined(LZMA_API_STATIC) && defined(_WIN32) # define LZMA_API_EXPORT __declspec(dllexport) // Don't use ifdef or defined() below. #elif HAVE_VISIBILITY -- cgit v1.2.3