summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorYann Collet <Cyan4973@users.noreply.github.com>2018-10-16 22:33:58 (GMT)
committerGitHub <noreply@github.com>2018-10-16 22:33:58 (GMT)
commit1b819bfd633ae285df2dfe1b0589e1ec064f2873 (patch)
tree7502b45264cd7c60e0872fc1d5cd25914f3c838d /lib
parentbf9bf80f8d06aab75347ed6df62758511e91fbe3 (diff)
parent6a2da13cb7adb8da42cbfd7c1d47ea5680009f27 (diff)
downloadlz4-1b819bfd633ae285df2dfe1b0589e1ec064f2873.zip
lz4-1b819bfd633ae285df2dfe1b0589e1ec064f2873.tar.gz
lz4-1b819bfd633ae285df2dfe1b0589e1ec064f2873.tar.bz2
Merge pull request #593 from felixhandte/lz4hc-publish-static
Extend Macro to Allow Publishing Experimental LZ4HC Functions in Dynamic Libraries
Diffstat (limited to 'lib')
-rw-r--r--lib/lz4.h39
-rw-r--r--lib/lz4hc.h35
2 files changed, 43 insertions, 31 deletions
diff --git a/lib/lz4.h b/lib/lz4.h
index 7e89d5f..c78f123 100644
--- a/lib/lz4.h
+++ b/lib/lz4.h
@@ -385,27 +385,26 @@ LZ4LIB_API int LZ4_decompress_safe_usingDict (const char* src, char* dst, int sr
LZ4LIB_API int LZ4_decompress_fast_usingDict (const char* src, char* dst, int originalSize, const char* dictStart, int dictSize);
-/*^**********************************************
+/*^*************************************
* !!!!!! STATIC LINKING ONLY !!!!!!
- ***********************************************/
+ ***************************************/
-/*-************************************
- * Unstable declarations
- **************************************
- * Declarations in this section must be considered unstable.
- * Their signatures may change, or may be removed in the future.
- * They are therefore only safe to depend on
- * when the caller is statically linked against the library.
- * To access their declarations, define LZ4_STATIC_LINKING_ONLY.
- **************************************/
-
-#ifdef LZ4_STATIC_LINKING_ONLY
-
-/* By default, symbols in this section aren't published into shared/dynamic libraries.
- * You can override this behavior and force them to be published
- * by defining LZ4_PUBLISH_STATIC_FUNCTIONS.
- * Use at your own risk.
- */
+/*-****************************************************************************
+ * Symbols declared in this section must be considered unstable. Their
+ * signatures or semantics may change, or they may be removed altogether in the
+ * future. They are therefore only safe to depend on when the caller is
+ * statically linked against the library.
+ *
+ * To protect against unsafe usage, not only are the declarations guarded, the
+ * definitions are hidden by default when building LZ4 as a shared/dynamic
+ * library.
+ *
+ * In order to access these declarations, define LZ4_STATIC_LINKING_ONLY in
+ * your application before including LZ4's headers.
+ *
+ * In order to make their implementations accessible dynamically, you must
+ * define LZ4_PUBLISH_STATIC_FUNCTIONS when building the LZ4 library.
+ ******************************************************************************/
#ifdef LZ4_PUBLISH_STATIC_FUNCTIONS
#define LZ4LIB_STATIC_API LZ4LIB_API
@@ -413,6 +412,8 @@ LZ4LIB_API int LZ4_decompress_fast_usingDict (const char* src, char* dst, int or
#define LZ4LIB_STATIC_API
#endif
+#ifdef LZ4_STATIC_LINKING_ONLY
+
/*! LZ4_resetStream_fast() :
* Use this to prepare a context for a new chain of calls to a streaming API
* (e.g., LZ4_compress_fast_continue()).
diff --git a/lib/lz4hc.h b/lib/lz4hc.h
index 26919af..d3fb594 100644
--- a/lib/lz4hc.h
+++ b/lib/lz4hc.h
@@ -272,10 +272,11 @@ extern "C" {
* or 0 if compression fails.
* `srcSizePtr` : value will be updated to indicate how much bytes were read from `src`
*/
-int LZ4_compress_HC_destSize(void* LZ4HC_Data,
- const char* src, char* dst,
- int* srcSizePtr, int targetDstSize,
- int compressionLevel);
+LZ4LIB_STATIC_API int LZ4_compress_HC_destSize(
+ void* LZ4HC_Data,
+ const char* src, char* dst,
+ int* srcSizePtr, int targetDstSize,
+ int compressionLevel);
/*! LZ4_compress_HC_continue_destSize() : v1.8.0 (experimental)
* Similar as LZ4_compress_HC_continue(),
@@ -286,20 +287,23 @@ int LZ4_compress_HC_destSize(void* LZ4HC_Data,
* or 0 if compression fails.
* `srcSizePtr` : value will be updated to indicate how much bytes were read from `src`.
*/
-int LZ4_compress_HC_continue_destSize(LZ4_streamHC_t* LZ4_streamHCPtr,
- const char* src, char* dst,
- int* srcSizePtr, int targetDstSize);
+LZ4LIB_STATIC_API int LZ4_compress_HC_continue_destSize(
+ LZ4_streamHC_t* LZ4_streamHCPtr,
+ const char* src, char* dst,
+ int* srcSizePtr, int targetDstSize);
/*! LZ4_setCompressionLevel() : v1.8.0 (experimental)
* It's possible to change compression level between 2 invocations of LZ4_compress_HC_continue*()
*/
-void LZ4_setCompressionLevel(LZ4_streamHC_t* LZ4_streamHCPtr, int compressionLevel);
+LZ4LIB_STATIC_API void LZ4_setCompressionLevel(
+ LZ4_streamHC_t* LZ4_streamHCPtr, int compressionLevel);
/*! LZ4_favorDecompressionSpeed() : v1.8.2 (experimental)
* Parser will select decisions favoring decompression over compression ratio.
* Only work at highest compression settings (level >= LZ4HC_CLEVEL_OPT_MIN)
*/
-void LZ4_favorDecompressionSpeed(LZ4_streamHC_t* LZ4_streamHCPtr, int favor);
+LZ4LIB_STATIC_API void LZ4_favorDecompressionSpeed(
+ LZ4_streamHC_t* LZ4_streamHCPtr, int favor);
/*! LZ4_resetStreamHC_fast() :
* When an LZ4_streamHC_t is known to be in a internally coherent state,
@@ -324,7 +328,8 @@ void LZ4_favorDecompressionSpeed(LZ4_streamHC_t* LZ4_streamHCPtr, int favor);
* may be passed to this function. However, it will be fully reset, which will
* clear any existing history and settings from the context.
*/
-void LZ4_resetStreamHC_fast(LZ4_streamHC_t* LZ4_streamHCPtr, int compressionLevel);
+LZ4LIB_STATIC_API void LZ4_resetStreamHC_fast(
+ LZ4_streamHC_t* LZ4_streamHCPtr, int compressionLevel);
/*! LZ4_compress_HC_extStateHC_fastReset() :
* A variant of LZ4_compress_HC_extStateHC().
@@ -337,7 +342,11 @@ void LZ4_resetStreamHC_fast(LZ4_streamHC_t* LZ4_streamHCPtr, int compressionLeve
* LZ4_resetStreamHC_fast() while LZ4_compress_HC_extStateHC() starts with a
* call to LZ4_resetStreamHC().
*/
-int LZ4_compress_HC_extStateHC_fastReset (void* state, const char* src, char* dst, int srcSize, int dstCapacity, int compressionLevel);
+LZ4LIB_STATIC_API int LZ4_compress_HC_extStateHC_fastReset (
+ void* state,
+ const char* src, char* dst,
+ int srcSize, int dstCapacity,
+ int compressionLevel);
/*! LZ4_attach_HC_dictionary() :
* This is an experimental API that allows for the efficient use of a
@@ -364,7 +373,9 @@ int LZ4_compress_HC_extStateHC_fastReset (void* state, const char* src, char* ds
* stream (and source buffer) must remain in-place / accessible / unchanged
* through the lifetime of the stream session.
*/
-LZ4LIB_API void LZ4_attach_HC_dictionary(LZ4_streamHC_t *working_stream, const LZ4_streamHC_t *dictionary_stream);
+LZ4LIB_STATIC_API void LZ4_attach_HC_dictionary(
+ LZ4_streamHC_t *working_stream,
+ const LZ4_streamHC_t *dictionary_stream);
#if defined (__cplusplus)
}