summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPrzemyslaw Skibinski <inikep@gmail.com>2016-11-09 15:07:28 (GMT)
committerPrzemyslaw Skibinski <inikep@gmail.com>2016-11-09 15:07:28 (GMT)
commit773ae50b477e052146f64c23e3b95d3cbc07db18 (patch)
treed535094d9926b9e5f3493fd0a34c431933d09c62
parentca80a7c8f77f5405cba5b8a52abb1dda78602bf7 (diff)
downloadlz4-773ae50b477e052146f64c23e3b95d3cbc07db18.zip
lz4-773ae50b477e052146f64c23e3b95d3cbc07db18.tar.gz
lz4-773ae50b477e052146f64c23e3b95d3cbc07db18.tar.bz2
DLL exports only functions defined in liblz4.def
-rw-r--r--lib/Makefile3
-rw-r--r--lib/liblz4.def62
-rw-r--r--lib/lz4frame.c7
-rw-r--r--tests/Makefile2
4 files changed, 70 insertions, 4 deletions
diff --git a/lib/Makefile b/lib/Makefile
index 6e58bb0..70bdfc7 100644
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -84,7 +84,8 @@ endif
liblz4: *.c
@echo compiling dynamic library $(LIBVER)
ifneq (,$(filter Windows%,$(OS)))
- @$(CC) $(FLAGS) -shared $^ -o $@.dll -Wl,--out-implib,liblz4.dll.a
+ @$(CC) $(FLAGS) -DLZ4_DLL_EXPORT=1 -shared $^ -o $@.dll
+ dlltool -D liblz4.dll -d liblz4.def -l liblz4.dll.a
else
@$(CC) $(FLAGS) -shared $^ -fPIC $(SONAME_FLAGS) -o $@.$(SHARED_EXT_VER)
@echo creating versioned links
diff --git a/lib/liblz4.def b/lib/liblz4.def
new file mode 100644
index 0000000..0ace223
--- /dev/null
+++ b/lib/liblz4.def
@@ -0,0 +1,62 @@
+LIBRARY liblz4.dll
+EXPORTS
+ LZ4F_compressBegin
+ LZ4F_compressBound
+ LZ4F_compressEnd
+ LZ4F_compressFrame
+ LZ4F_compressFrameBound
+ LZ4F_compressUpdate
+ LZ4F_createCompressionContext
+ LZ4F_createDecompressionContext
+ LZ4F_decompress
+ LZ4F_flush
+ LZ4F_freeCompressionContext
+ LZ4F_freeDecompressionContext
+ LZ4F_getErrorName
+ LZ4F_getFrameInfo
+ LZ4F_getVersion
+ LZ4F_isError
+ LZ4_compress
+ LZ4_compressBound
+ LZ4_compressHC
+ LZ4_compressHC_continue
+ LZ4_compressHC_limitedOutput
+ LZ4_compressHC_limitedOutput_continue
+ LZ4_compressHC_limitedOutput_withStateHC
+ LZ4_compressHC_withStateHC
+ LZ4_compress_HC
+ LZ4_compress_HC_continue
+ LZ4_compress_HC_extStateHC
+ LZ4_compress_continue
+ LZ4_compress_default
+ LZ4_compress_destSize
+ LZ4_compress_fast
+ LZ4_compress_fast_continue
+ LZ4_compress_fast_extState
+ LZ4_compress_limitedOutput
+ LZ4_compress_limitedOutput_continue
+ LZ4_compress_limitedOutput_withState
+ LZ4_compress_withState
+ LZ4_createStream
+ LZ4_createStreamDecode
+ LZ4_createStreamHC
+ LZ4_decompress_fast
+ LZ4_decompress_fast_continue
+ LZ4_decompress_fast_usingDict
+ LZ4_decompress_safe
+ LZ4_decompress_safe_continue
+ LZ4_decompress_safe_partial
+ LZ4_decompress_safe_usingDict
+ LZ4_freeStream
+ LZ4_freeStreamDecode
+ LZ4_freeStreamHC
+ LZ4_loadDict
+ LZ4_loadDictHC
+ LZ4_resetStream
+ LZ4_resetStreamHC
+ LZ4_saveDict
+ LZ4_saveDictHC
+ LZ4_setStreamDecode
+ LZ4_sizeofState
+ LZ4_sizeofStateHC
+ LZ4_versionNumber
diff --git a/lib/lz4frame.c b/lib/lz4frame.c
index 93657aa..f5b62dc 100644
--- a/lib/lz4frame.c
+++ b/lib/lz4frame.c
@@ -201,7 +201,11 @@ const char* LZ4F_getErrorName(LZ4F_errorCode_t code)
return codeError;
}
-static LZ4F_errorCode_t err0r(LZ4F_errorCodes code) { return (LZ4F_errorCode_t)-(ptrdiff_t)code; }
+static LZ4F_errorCode_t err0r(LZ4F_errorCodes code)
+{
+ LZ4_STATIC_ASSERT(sizeof(ptrdiff_t) >= sizeof(size_t)); /* A compilation error here means sizeof(ptrdiff_t) is not large enough */
+ return (LZ4F_errorCode_t)-(ptrdiff_t)code;
+}
unsigned LZ4F_getVersion(void) { return LZ4F_VERSION; }
@@ -384,7 +388,6 @@ size_t LZ4F_compressBegin(LZ4F_cctx* cctxPtr, void* dstBuffer, size_t dstMaxSize
BYTE* headerStart;
size_t requiredBuffSize;
- LZ4_STATIC_ASSERT(sizeof(ptrdiff_t) >= sizeof(size_t)); /* A compilation error here means sizeof(ptrdiff_t) is not large enough */
if (dstMaxSize < maxFHSize) return err0r(LZ4F_ERROR_dstMaxSize_tooSmall);
if (cctxPtr->cStage != 0) return err0r(LZ4F_ERROR_GENERIC);
memset(&prefNull, 0, sizeof(prefNull));
diff --git a/tests/Makefile b/tests/Makefile
index 586e8f6..6df6381 100644
--- a/tests/Makefile
+++ b/tests/Makefile
@@ -91,7 +91,7 @@ fullbench-lib: fullbench.c $(LZ4DIR)/xxhash.c
fullbench-dll: fullbench.c $(LZ4DIR)/xxhash.c
$(MAKE) -C $(LZ4DIR) liblz4
- $(CC) $(FLAGS) $^ -o $@$(EXT) $(LZ4DIR)/liblz4.dll.a
+ $(CC) $(FLAGS) $^ -o $@$(EXT) -DLZ4_DLL_IMPORT=1 $(LZ4DIR)/liblz4.dll.a
fuzzer : $(LZ4DIR)/lz4.o $(LZ4DIR)/lz4hc.o $(LZ4DIR)/xxhash.o fuzzer.c
$(CC) $(FLAGS) $^ -o $@$(EXT)