aboutsummaryrefslogtreecommitdiff
path: root/src/liblzma/api
diff options
context:
space:
mode:
authorLasse Collin <lasse.collin@tukaani.org>2009-02-01 00:10:07 +0200
committerLasse Collin <lasse.collin@tukaani.org>2009-02-01 00:10:07 +0200
commitd64ca34f1b6f34e86adefc7f735b4eff8e6d4a35 (patch)
tree69a3ec2061b762679bd986836012572d1e188d94 /src/liblzma/api
parentAdd LZMA_API to liblzma API headers. It's useful at least (diff)
downloadxz-d64ca34f1b6f34e86adefc7f735b4eff8e6d4a35.tar.xz
Use __cdecl also for function pointers in liblzma API when
on Windows.
Diffstat (limited to 'src/liblzma/api')
-rw-r--r--src/liblzma/api/lzma.h18
-rw-r--r--src/liblzma/api/lzma/base.h4
2 files changed, 13 insertions, 9 deletions
diff --git a/src/liblzma/api/lzma.h b/src/liblzma/api/lzma.h
index bb617213..d4c69323 100644
--- a/src/liblzma/api/lzma.h
+++ b/src/liblzma/api/lzma.h
@@ -154,15 +154,19 @@
******************/
/*
- * Some systems require that the functions are declared specially
- * in the headers.
+ * Some systems require (or at least recommend) that the functions and
+ * function pointers are declared specially in the headers.
*/
+#ifdef _WIN32
+# define LZMA_API_CALL __cdecl
+# define LZMA_API_IMPORT __declspec(dllimport)
+#else
+# define LZMA_API_CALL
+# define LZMA_API_IMPORT
+#endif
+
#ifndef LZMA_API
-# if defined(_WIN32)
-# define LZMA_API __cdecl __declspec(dllimport)
-# else
-# define LZMA_API
-# endif
+# define LZMA_API LZMA_API_CALL LZMA_API_IMPORT
#endif
diff --git a/src/liblzma/api/lzma/base.h b/src/liblzma/api/lzma/base.h
index 9fe3ca66..4944e690 100644
--- a/src/liblzma/api/lzma/base.h
+++ b/src/liblzma/api/lzma/base.h
@@ -376,7 +376,7 @@ typedef struct {
* returned NULL if some function from liblzma
* returns LZMA_MEM_ERROR.
*/
- void *(*alloc)(void *opaque, size_t nmemb, size_t size);
+ void *(LZMA_API_CALL *alloc)(void *opaque, size_t nmemb, size_t size);
/**
* \brief Pointer to a custom memory freeing function
@@ -390,7 +390,7 @@ typedef struct {
* or when it is set to NULL, a pointer returned
* by the standard malloc().
*/
- void (*free)(void *opaque, void *ptr);
+ void (LZMA_API_CALL *free)(void *opaque, void *ptr);
/**
* \brief Pointer passed to .alloc() and .free()