From 1f48382b1afbbe1aacc00f7484b26845244c3e25 Mon Sep 17 00:00:00 2001 From: Alexander Borzunov Date: Thu, 18 Aug 2016 16:12:49 +0500 Subject: [PATCH 1/2] Export functions related to dictionary compression from DLL --- lib/dictBuilder/zdict.h | 19 ++++++++++++++++--- lib/zstd.h | 2 +- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/lib/dictBuilder/zdict.h b/lib/dictBuilder/zdict.h index d61b5922c..895f86766 100644 --- a/lib/dictBuilder/zdict.h +++ b/lib/dictBuilder/zdict.h @@ -38,6 +38,19 @@ extern "C" { #endif + +/*====== Export for Windows ======*/ +/*! +* ZSTD_DLL_EXPORT : +* Enable exporting of functions when building a Windows DLL +*/ +#if defined(_WIN32) && defined(ZSTD_DLL_EXPORT) && (ZSTD_DLL_EXPORT==1) +# define ZSTDLIB_API __declspec(dllexport) +#else +# define ZSTDLIB_API +#endif + + /*! ZDICT_trainFromBuffer() : Train a dictionary from an array of samples. Samples must be stored concatenated in a single flat buffer `samplesBuffer`, @@ -50,13 +63,13 @@ extern "C" { In general, it's recommended to provide a few thousands samples, but this can vary a lot. It's recommended that total size of all samples be about ~x100 times the target size of dictionary. */ -size_t ZDICT_trainFromBuffer(void* dictBuffer, size_t dictBufferCapacity, +ZSTDLIB_API size_t ZDICT_trainFromBuffer(void* dictBuffer, size_t dictBufferCapacity, const void* samplesBuffer, const size_t* samplesSizes, unsigned nbSamples); /*====== Helper functions ======*/ -unsigned ZDICT_isError(size_t errorCode); -const char* ZDICT_getErrorName(size_t errorCode); +ZSTDLIB_API unsigned ZDICT_isError(size_t errorCode); +ZSTDLIB_API const char* ZDICT_getErrorName(size_t errorCode); diff --git a/lib/zstd.h b/lib/zstd.h index 056940ff1..dbca06cdd 100644 --- a/lib/zstd.h +++ b/lib/zstd.h @@ -92,7 +92,7 @@ ZSTDLIB_API size_t ZSTD_compress( void* dst, size_t dstCapacity, * Always ensure result fits within application's authorized limits ! * Each application can set its own limits. * note 4 : when `return==0`, if precise failure cause is needed, use ZSTD_getFrameParams() to know more. */ -unsigned long long ZSTD_getDecompressedSize(const void* src, size_t srcSize); +ZSTDLIB_API unsigned long long ZSTD_getDecompressedSize(const void* src, size_t srcSize); /*! ZSTD_decompress() : `compressedSize` : must be the _exact_ size of compressed input, otherwise decompression will fail. From 0f6f17a14f77a7b8ff8f213bd75061a7556684b4 Mon Sep 17 00:00:00 2001 From: Alexander Borzunov Date: Thu, 18 Aug 2016 16:47:06 +0500 Subject: [PATCH 2/2] Rename ZSTDLIB_API to ZDICTLIB_API in zdict.h --- lib/dictBuilder/zdict.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/dictBuilder/zdict.h b/lib/dictBuilder/zdict.h index 895f86766..67dba70d7 100644 --- a/lib/dictBuilder/zdict.h +++ b/lib/dictBuilder/zdict.h @@ -45,9 +45,9 @@ extern "C" { * Enable exporting of functions when building a Windows DLL */ #if defined(_WIN32) && defined(ZSTD_DLL_EXPORT) && (ZSTD_DLL_EXPORT==1) -# define ZSTDLIB_API __declspec(dllexport) +# define ZDICTLIB_API __declspec(dllexport) #else -# define ZSTDLIB_API +# define ZDICTLIB_API #endif @@ -63,13 +63,13 @@ extern "C" { In general, it's recommended to provide a few thousands samples, but this can vary a lot. It's recommended that total size of all samples be about ~x100 times the target size of dictionary. */ -ZSTDLIB_API size_t ZDICT_trainFromBuffer(void* dictBuffer, size_t dictBufferCapacity, +ZDICTLIB_API size_t ZDICT_trainFromBuffer(void* dictBuffer, size_t dictBufferCapacity, const void* samplesBuffer, const size_t* samplesSizes, unsigned nbSamples); /*====== Helper functions ======*/ -ZSTDLIB_API unsigned ZDICT_isError(size_t errorCode); -ZSTDLIB_API const char* ZDICT_getErrorName(size_t errorCode); +ZDICTLIB_API unsigned ZDICT_isError(size_t errorCode); +ZDICTLIB_API const char* ZDICT_getErrorName(size_t errorCode);