DLL exports only functions defined in liblz4.def

This commit is contained in:
Przemyslaw Skibinski 2016-11-09 16:07:28 +01:00
parent ca80a7c8f7
commit 773ae50b47
4 changed files with 70 additions and 4 deletions

View File

@ -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

62
lib/liblz4.def Normal file
View File

@ -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

View File

@ -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));

View File

@ -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)