Always rely on GCC's auto-import on Windows.

I understood that this is nicer, because then people
don't need to worry about the LZMA_API_STATIC macro.

Thanks to Charles Wilson and Keith Marshall.
This commit is contained in:
Lasse Collin 2009-12-09 00:38:55 +02:00
parent 7b76a3e233
commit f7e44c6c11
1 changed files with 9 additions and 7 deletions

View File

@ -162,10 +162,9 @@
******************/ ******************/
/* /*
* Some systems require (or at least recommend) that the functions and * Some systems require that the functions and function pointers are
* function pointers are declared specially in the headers. LZMA_API_IMPORT * declared specially in the headers. LZMA_API_IMPORT is for importing
* is for importing symbols and LZMA_API_CALL is to specify calling * symbols and LZMA_API_CALL is to specify the calling convention.
* convention.
* *
* By default it is assumed that the application will link dynamically * By default it is assumed that the application will link dynamically
* against liblzma. #define LZMA_API_STATIC in your application if you * against liblzma. #define LZMA_API_STATIC in your application if you
@ -174,11 +173,14 @@
* against static liblzma on them, don't worry about LZMA_API_STATIC. That * against static liblzma on them, don't worry about LZMA_API_STATIC. That
* is, most developers will never need to use LZMA_API_STATIC. * 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 * The GCC variants are a special case on Windows (Cygwin and MinGW).
* and thus don't use dllimport and don't specify the calling convention. * We rely on GCC doing the right thing with its auto-import feature,
* and thus don't use __declspec(dllimport). This way developers don't
* need to worry about LZMA_API_STATIC. Also the calling convention is
* omitted on Cygwin but not on MinGW.
*/ */
#ifndef LZMA_API_IMPORT #ifndef LZMA_API_IMPORT
# if !defined(LZMA_API_STATIC) && defined(_WIN32) && !defined(__CYGWIN__) # if !defined(LZMA_API_STATIC) && defined(_WIN32) && !defined(__GNUC__)
# define LZMA_API_IMPORT __declspec(dllimport) # define LZMA_API_IMPORT __declspec(dllimport)
# else # else
# define LZMA_API_IMPORT # define LZMA_API_IMPORT