update to 0.4.7

This commit is contained in:
Razor12911
2022-03-29 04:36:39 +02:00
parent d7fdc2b45c
commit ba0b997871
23 changed files with 1370 additions and 732 deletions

View File

@@ -26,11 +26,9 @@ begin
'grittibanzli_dll.dll'));
if DLLHandle >= 32 then
begin
DLLLoaded := True;
@Grittibanzli := GetProcAddress(DLLHandle, '__Grittibanzli');
Assert(@Grittibanzli <> nil);
@Ungrittibanzli := GetProcAddress(DLLHandle, '__Ungrittibanzli');
Assert(@Ungrittibanzli <> nil);
DLLLoaded := Assigned(Grittibanzli) and Assigned(Ungrittibanzli);
end
else
DLLLoaded := False;

View File

@@ -4,7 +4,7 @@ interface
uses
WinAPI.Windows,
System.SysUtils, System.Classes;
System.SysUtils;
const
LZ4F_VERSION = 100;
@@ -13,15 +13,18 @@ type
LZ4F_errorCode_t = type size_t;
LZ4F_blockSizeID_t = (LZ4F_default = 0, LZ4F_max64KB = 4, LZ4F_max256KB = 5,
LZ4F_max1MB = 6, LZ4F_max4MB = 7);
LZ4F_blockMode_t = (LZ4F_blockLinked = 0, LZ4F_blockIndependent);
LZ4F_max1MB = 6, LZ4F_max4MB = 7, LZ4F_blockSizeID_Force32 = $40000000);
LZ4F_blockMode_t = (LZ4F_blockLinked = 0, LZ4F_blockIndependent,
LZ4F_blockMode_Force32 = $40000000);
LZ4F_contentChecksum_t = (LZ4F_noContentChecksum = 0,
LZ4F_contentChecksumEnabled);
LZ4F_contentChecksumEnabled, LZ4F_contentChecksum_Force32 = $40000000);
LZ4F_blockChecksum_t = (LZ4F_noBlockChecksum = 0, LZ4F_blockChecksumEnabled);
LZ4F_blockChecksum_t = (LZ4F_noBlockChecksum = 0, LZ4F_blockChecksumEnabled,
LZ4F_blockChecksum_Force32 = $40000000);
LZ4F_frameType_t = (LZ4F_frame = 0, LZ4F_skippableFrame);
LZ4F_frameType_t = (LZ4F_frame = 0, LZ4F_skippableFrame,
LZ4F_frameType_Force32 = $40000000);
LZ4F_frameInfo_t = record
blockSizeID: LZ4F_blockSizeID_t;
@@ -64,8 +67,8 @@ var
LZ4_compress_HC: function(const src: Pointer; dst: Pointer; srcSize: Integer;
maxDstSize: Integer; compressionLevel: Integer): Integer cdecl;
LZ4F_compressFrame: function(dstBuffer: Pointer; dstCapacity: size_t;
srcBuffer: Pointer; srcSize: size_t;
const preferencesPtr: LZ4F_preferences_t): size_t cdecl;
srcBuffer: Pointer; srcSize: size_t; preferencesPtr: PLZ4F_preferences_t)
: size_t cdecl;
LZ4F_compressFrameBound: function(srcSize: size_t;
preferencesPtr: PLZ4F_preferences_t): size_t cdecl;
LZ4F_createDecompressionContext: function(out dctxPtr: LZ4F_dctx;
@@ -88,41 +91,29 @@ implementation
var
DLLHandle: THandle;
procedure Init;
procedure Init(Filename: String);
begin
if DLLLoaded then
Exit;
DLLHandle := 0;
DLLHandle := LoadLibrary(PWideChar(ExtractFilePath(ParamStr(0)) +
'liblz4.dll'));
DLLHandle := LoadLibrary(PWideChar(ExtractFilePath(ParamStr(0)) + Filename));
if DLLHandle >= 32 then
begin
DLLLoaded := True;
@LZ4_decompress_safe := GetProcAddress(DLLHandle, 'LZ4_decompress_safe');
Assert(@LZ4_decompress_safe <> nil);
@LZ4_decompress_fast := GetProcAddress(DLLHandle, 'LZ4_decompress_fast');
Assert(@LZ4_decompress_fast <> nil);
@LZ4_compress_default := GetProcAddress(DLLHandle, 'LZ4_compress_default');
Assert(@LZ4_compress_default <> nil);
@LZ4_compress_fast := GetProcAddress(DLLHandle, 'LZ4_compress_fast');
Assert(@LZ4_compress_fast <> nil);
@LZ4_compress_HC := GetProcAddress(DLLHandle, 'LZ4_compress_HC');
Assert(@LZ4_compress_HC <> nil);
@LZ4F_compressFrame := GetProcAddress(DLLHandle, 'LZ4F_compressFrame');
Assert(@LZ4F_compressFrame <> nil);
@LZ4F_compressFrameBound := GetProcAddress(DLLHandle,
'LZ4F_compressFrameBound');
Assert(@LZ4F_compressFrameBound <> nil);
@LZ4F_createDecompressionContext := GetProcAddress(DLLHandle,
'LZ4F_createDecompressionContext');
Assert(@LZ4F_createDecompressionContext <> nil);
@LZ4F_freeDecompressionContext := GetProcAddress(DLLHandle,
'LZ4F_freeDecompressionContext');
Assert(@LZ4F_freeDecompressionContext <> nil);
@LZ4F_decompress := GetProcAddress(DLLHandle, 'LZ4F_decompress');
Assert(@LZ4F_decompress <> nil);
@LZ4F_getFrameInfo := GetProcAddress(DLLHandle, 'LZ4F_getFrameInfo');
Assert(@LZ4F_getFrameInfo <> nil);
DLLLoaded := Assigned(LZ4_decompress_safe);
end
else
DLLLoaded := False;
@@ -157,9 +148,24 @@ begin
end;
end;
const
DLLParam = '--lz4=';
var
I: Integer;
DLLFile: String;
initialization
Init;
DLLFile := 'liblz4.dll';
for I := 1 to ParamCount do
if ParamStr(I).StartsWith(DLLParam) then
begin
DLLFile := ParamStr(I).Substring(DLLParam.Length);
break;
end;
Init(DLLFile);
finalization

View File

@@ -104,50 +104,29 @@ begin
compression_level);
end;
procedure Init;
procedure Init(Filename: String);
begin
if DLLLoaded then
Exit;
DLLHandle := LoadLibrary(PChar(ExtractFilePath(ParamStr(0)) + 'lzo2.dll'));
DLLHandle := LoadLibrary(PChar(ExtractFilePath(ParamStr(0)) + Filename));
if DLLHandle >= 32 then
begin
DLLLoaded := True;
@lzo1x_1_compress := GetProcAddress(DLLHandle, 'lzo1x_1_compress');
Assert(@lzo1x_1_compress <> nil);
@lzo1x_1_11_compress := GetProcAddress(DLLHandle, 'lzo1x_1_11_compress');
Assert(@lzo1x_1_11_compress <> nil);
@lzo1x_1_12_compress := GetProcAddress(DLLHandle, 'lzo1x_1_12_compress');
Assert(@lzo1x_1_12_compress <> nil);
@lzo1x_1_15_compress := GetProcAddress(DLLHandle, 'lzo1x_1_15_compress');
Assert(@lzo1x_1_15_compress <> nil);
@lzo1x_999_compress := GetProcAddress(DLLHandle, 'lzo1x_999_compress');
Assert(@lzo1x_999_compress <> nil);
@lzo1x_999_compress_level := GetProcAddress(DLLHandle,
'lzo1x_999_compress_level');
Assert(@lzo1x_999_compress_level <> nil);
@lzo1x_decompress_safe := GetProcAddress(DLLHandle,
'lzo1x_decompress_safe');
Assert(@lzo1x_decompress_safe <> nil);
@lzo1c_999_compress := GetProcAddress(DLLHandle, 'lzo1c_999_compress');
Assert(@lzo1c_999_compress <> nil);
@lzo1c_decompress_safe := GetProcAddress(DLLHandle,
'lzo1c_decompress_safe');
Assert(@lzo1c_decompress_safe <> nil);
@lzo2a_999_compress := GetProcAddress(DLLHandle, 'lzo2a_999_compress');
Assert(@lzo2a_999_compress <> nil);
@lzo2a_decompress_safe := GetProcAddress(DLLHandle,
'lzo2a_decompress_safe');
Assert(@lzo2a_decompress_safe <> nil);
(* if Length(lzoprodll) > 0 then
begin
MDLLHandle := MemoryLoadLibary(@lzoprodll[0]);
@lzopro_lzo1x_w03_15_compress := MemoryGetProcAddress(MDLLHandle,
'lzopro_lzo1x_w03_15_compress');
Assert(@lzopro_lzo1x_w03_15_compress <> nil);
@lzopro_lzo1x_99_compress := MemoryGetProcAddress(MDLLHandle,
'lzopro_lzo1x_99_compress');
Assert(@lzopro_lzo1x_99_compress <> nil);
end; *)
DLLLoaded := Assigned(lzo1x_decompress_safe);
end
else
DLLLoaded := False;
@@ -160,9 +139,23 @@ begin
FreeLibrary(DLLHandle);
end;
const
DLLParam = '--lzo=';
var
I: integer;
DLLFile: String;
initialization
Init;
DLLFile := 'lzo2.dll';
for I := 1 to ParamCount do
if ParamStr(I).StartsWith(DLLParam) then
begin
DLLFile := ParamStr(I).Substring(DLLParam.Length);
break;
end;
Init(DLLFile);
finalization

View File

@@ -77,7 +77,7 @@ var
OldGetCompressedBufferSizeNeeded: Boolean;
DLLs: TStringDynArray;
procedure Init;
procedure Init(Filename: String);
var
I: Integer;
C: Cardinal;
@@ -86,6 +86,7 @@ begin
Exit;
DLLs := TDirectory.GetFiles(ExtractFilePath(ParamStr(0)), 'oo2core*.dll',
TSearchOption.soTopDirectoryOnly);
Insert(ExtractFilePath(ParamStr(0)) + Filename, DLLs, 0);
for I := Low(DLLs) to High(DLLs) do
begin
DLLHandle := LoadLibrary(PChar(DLLs[I]));
@@ -107,8 +108,6 @@ begin
begin
DLLs := TDirectory.GetFiles(ExtractFilePath(ParamStr(0)), 'oodle2*.dll',
TSearchOption.soTopDirectoryOnly);
SetLength(DLLs, Succ(Length(DLLs)));
DLLs[Pred(Length(DLLs))] := ExtractFilePath(ParamStr(0)) + 'oodle.dll';
for I := Low(DLLs) to High(DLLs) do
begin
DLLHandle := LoadLibrary(PChar(DLLs[I]));
@@ -118,7 +117,6 @@ begin
end;
if DLLHandle >= 32 then
begin
DLLLoaded := True;
Oodle_CheckVersion := GetProcAddress(DLLHandle, 'Oodle_CheckVersion');
if not Assigned(Oodle_CheckVersion) then
for I := 0 to 32 do
@@ -128,7 +126,7 @@ begin
if Assigned(Oodle_CheckVersion) then
break;
end;
Assert(@Oodle_CheckVersion <> nil);
DLLLoaded := Assigned(Oodle_CheckVersion);
Oodle_CheckVersion(0, @C);
OldCompress := LongRec(C).Hi < $2E06;
OldGetCompressedBufferSizeNeeded := LongRec(C).Hi < $2E08;
@@ -142,7 +140,6 @@ begin
if Assigned(OodleLZ_Compress_1) then
break;
end;
Assert(@OodleLZ_Compress_1 <> nil);
@OodleLZ_Compress_2 := @OodleLZ_Compress_1;
OodleLZ_Decompress := GetProcAddress(DLLHandle, 'OodleLZ_Decompress');
if not Assigned(OodleLZ_Decompress) then
@@ -153,7 +150,6 @@ begin
if Assigned(OodleLZ_Decompress) then
break;
end;
Assert(@OodleLZ_Decompress <> nil);
OodleLZ_CompressOptions_GetDefault_1 := GetProcAddress(DLLHandle,
'OodleLZ_CompressOptions_GetDefault');
if not Assigned(OodleLZ_CompressOptions_GetDefault_1) then
@@ -165,7 +161,6 @@ begin
if Assigned(OodleLZ_CompressOptions_GetDefault_1) then
break;
end;
Assert(@OodleLZ_CompressOptions_GetDefault_1 <> nil);
@OodleLZ_CompressOptions_GetDefault_2 :=
@OodleLZ_CompressOptions_GetDefault_1;
OodleLZ_GetCompressedBufferSizeNeeded_1 :=
@@ -179,7 +174,6 @@ begin
if Assigned(OodleLZ_GetCompressedBufferSizeNeeded_1) then
break;
end;
Assert(@OodleLZ_GetCompressedBufferSizeNeeded_1 <> nil);
@OodleLZ_GetCompressedBufferSizeNeeded_2 :=
@OodleLZ_GetCompressedBufferSizeNeeded_1;
end
@@ -225,9 +219,23 @@ begin
Result := OodleLZ_GetCompressedBufferSizeNeeded_2(compressor, rawSize);
end;
const
DLLParam = '--oodle=';
var
I: Integer;
DLLFile: String;
initialization
Init;
DLLFile := 'oodle.dll';
for I := 1 to ParamCount do
if ParamStr(I).StartsWith(DLLParam) then
begin
DLLFile := ParamStr(I).Substring(DLLParam.Length);
break;
end;
Init(DLLFile);
finalization

View File

@@ -26,11 +26,9 @@ begin
'preflate_dll.dll'));
if DLLHandle >= 32 then
begin
DLLLoaded := True;
@preflate_decode := GetProcAddress(DLLHandle, 'decode');
Assert(@preflate_decode <> nil);
@preflate_reencode := GetProcAddress(DLLHandle, 'reencode');
Assert(@preflate_reencode <> nil);
DLLLoaded := Assigned(preflate_decode) and Assigned(preflate_reencode);
end
else
DLLLoaded := False;

View File

@@ -35,33 +35,20 @@ begin
'HIF2RAW_DLL.DLL'));
if (DLLHandle1 >= 32) and (DLLHandle2 >= 32) then
begin
DLLLoaded := True;
@raw2hif_Alloc := GetProcAddress(DLLHandle1, 'raw2hif_Alloc');
Assert(@raw2hif_Alloc <> nil);
@raw2hif_Free := GetProcAddress(DLLHandle1, 'raw2hif_Free');
Assert(@raw2hif_Free <> nil);
@raw2hif_Init := GetProcAddress(DLLHandle1, 'raw2hif_Init');
Assert(@raw2hif_Init <> nil);
@raw2hif_Loop := GetProcAddress(DLLHandle1, 'raw2hif_Loop');
Assert(@raw2hif_Loop <> nil);
@raw2hif_getoutlen := GetProcAddress(DLLHandle1, 'raw2hif_getoutlen');
Assert(@raw2hif_getoutlen <> nil);
@raw2hif_getou2len := GetProcAddress(DLLHandle1, 'raw2hif_getou2len');
Assert(@raw2hif_getou2len <> nil);
@raw2hif_addbuf := GetProcAddress(DLLHandle1, 'raw2hif_addbuf');
Assert(@raw2hif_addbuf <> nil);
@hif2raw_Alloc := GetProcAddress(DLLHandle2, 'hif2raw_Alloc');
Assert(@hif2raw_Alloc <> nil);
@hif2raw_Free := GetProcAddress(DLLHandle2, 'hif2raw_Free');
Assert(@hif2raw_Free <> nil);
@hif2raw_Init := GetProcAddress(DLLHandle2, 'hif2raw_Init');
Assert(@hif2raw_Init <> nil);
@hif2raw_Loop := GetProcAddress(DLLHandle2, 'hif2raw_Loop');
Assert(@hif2raw_Loop <> nil);
@hif2raw_getoutlen := GetProcAddress(DLLHandle2, 'hif2raw_getoutlen');
Assert(@hif2raw_getoutlen <> nil);
@hif2raw_addbuf := GetProcAddress(DLLHandle2, 'hif2raw_addbuf');
Assert(@hif2raw_addbuf <> nil);
DLLLoaded := Assigned(raw2hif_Alloc) and Assigned(hif2raw_Alloc);
end
else
DLLLoaded := False;

View File

@@ -90,7 +90,7 @@ var
WinAPIDLL: boolean;
DLLs: TStringDynArray;
procedure Init;
procedure Init(Filename: String);
var
I: integer;
begin
@@ -99,6 +99,7 @@ begin
DLLs := TDirectory.GetFiles(ExtractFilePath(ParamStr(0)), 'zlib*.dll',
TSearchOption.soTopDirectoryOnly);
Insert(ExtractFilePath(ParamStr(0)) + 'zlib.dll', DLLs, Length(DLLs));
Insert(ExtractFilePath(ParamStr(0)) + Filename, DLLs, 0);
for I := Low(DLLs) to High(DLLs) do
begin
DLLHandle := LoadLibrary(PChar(DLLs[I]));
@@ -110,31 +111,25 @@ begin
begin
DLLLoaded := True;
@_zlibVersion := GetProcAddress(DLLHandle, 'zlibVersion');
Assert(@_zlibVersion <> nil);
@_zlibCompileFlags := GetProcAddress(DLLHandle, 'zlibCompileFlags');
Assert(@_zlibCompileFlags <> nil);
WinAPIDLL := _zlibCompileFlags and $400 = $400;
if WinAPIDLL then
DLLLoaded := Assigned(_zlibVersion) and Assigned(_zlibCompileFlags);
if DLLLoaded then
begin
@s_deflateInit2_ := GetProcAddress(DLLHandle, 'deflateInit2_');
Assert(@s_deflateInit2_ <> nil);
@s_deflate := GetProcAddress(DLLHandle, 'deflate');
Assert(@s_deflate <> nil);
@s_deflateEnd := GetProcAddress(DLLHandle, 'deflateEnd');
Assert(@s_deflateEnd <> nil);
@s_deflateReset := GetProcAddress(DLLHandle, 'deflateReset');
Assert(@s_deflateReset <> nil);
end
else
begin
@c_deflateInit2_ := GetProcAddress(DLLHandle, 'deflateInit2_');
Assert(@c_deflateInit2_ <> nil);
@c_deflate := GetProcAddress(DLLHandle, 'deflate');
Assert(@c_deflate <> nil);
@c_deflateEnd := GetProcAddress(DLLHandle, 'deflateEnd');
Assert(@c_deflateEnd <> nil);
@c_deflateReset := GetProcAddress(DLLHandle, 'deflateReset');
Assert(@c_deflateReset <> nil);
WinAPIDLL := _zlibCompileFlags and $400 = $400;
if WinAPIDLL then
begin
@s_deflateInit2_ := GetProcAddress(DLLHandle, 'deflateInit2_');
@s_deflate := GetProcAddress(DLLHandle, 'deflate');
@s_deflateEnd := GetProcAddress(DLLHandle, 'deflateEnd');
@s_deflateReset := GetProcAddress(DLLHandle, 'deflateReset');
end
else
begin
@c_deflateInit2_ := GetProcAddress(DLLHandle, 'deflateInit2_');
@c_deflate := GetProcAddress(DLLHandle, 'deflate');
@c_deflateEnd := GetProcAddress(DLLHandle, 'deflateEnd');
@c_deflateReset := GetProcAddress(DLLHandle, 'deflateReset');
end;
end;
end
else
@@ -204,9 +199,24 @@ begin
FreeLibrary(DLLHandle);
end;
const
DLLParam = '--zlib=';
var
I: integer;
DLLFile: String;
initialization
Init;
DLLFile := 'zlibwapi.dll';
for I := 1 to ParamCount do
if ParamStr(I).StartsWith(DLLParam) then
begin
DLLFile := ParamStr(I).Substring(DLLParam.Length);
break;
end;
Init(DLLFile);
finalization

View File

@@ -100,31 +100,6 @@ var
dstCapacity: size_t; const src: Pointer; srcSize: size_t;
const ddict: Pointer): size_t cdecl;
ZSTD_getParams: function(compressionLevel: Integer; estimatedSrcSize: UInt64;
dictSize: size_t): ZSTD_parameters cdecl;
ZSTD_initCStream: function(zcs: Pointer; compressionLevel: Integer)
: size_t cdecl;
ZSTD_initCStream_advanced: function(zcs: Pointer; const dict: Pointer;
dictSize: size_t; params: ZSTD_parameters; pledgedSrcSize: UInt64)
: size_t cdecl;
ZSTD_compressStream: function(zcs: Pointer; output: PZSTD_outBuffer;
input: PZSTD_inBuffer): size_t cdecl;
ZSTD_flushStream: function(zcs: Pointer; output: PZSTD_outBuffer)
: size_t cdecl;
ZSTD_endStream: function(zcs: Pointer; output: PZSTD_outBuffer): size_t cdecl;
ZSTD_createCCtxParams: function: PZSTD_CCtx_params cdecl;
ZSTD_freeCCtxParams: function(params: PZSTD_CCtx_params): size_t cdecl;
ZSTD_CCtxParams_reset: function(params: PZSTD_CCtx_params): size_t cdecl;
ZSTD_CCtxParams_init: function(cctxParams: PZSTD_CCtx_params;
compressionLevel: Integer): size_t cdecl;
ZSTD_CCtx_setParameter: function(params: PZSTD_CCtx_params;
param: ZSTD_cParameter; value: Integer): size_t cdecl;
ZSTD_CCtx_setParametersUsingCCtxParams: function(cctx: Pointer;
const params: PZSTD_CCtx_params): size_t cdecl;
ZSTD_CStreamInSize: function: size_t cdecl;
ZSTD_CStreamOutSize: function: size_t cdecl;
DLLLoaded: Boolean = False;
function ZSTD_compress_dict(cctx: Pointer; dst: Pointer; dstCapacity: size_t;
@@ -155,86 +130,34 @@ end;
var
DLLHandle: THandle;
procedure Init;
procedure Init(Filename: String);
begin
if DLLLoaded then
Exit;
DLLHandle := LoadLibrary(PChar(ExtractFilePath(ParamStr(0)) + 'libzstd.dll'));
DLLHandle := LoadLibrary(PChar(ExtractFilePath(ParamStr(0)) + Filename));
if DLLHandle >= 32 then
begin
DLLLoaded := True;
@ZSTD_compress := GetProcAddress(DLLHandle, 'ZSTD_compress');
Assert(@ZSTD_compress <> nil);
@ZSTD_decompress := GetProcAddress(DLLHandle, 'ZSTD_decompress');
Assert(@ZSTD_decompress <> nil);
@ZSTD_findFrameCompressedSize := GetProcAddress(DLLHandle,
'ZSTD_findFrameCompressedSize');
Assert(@ZSTD_findFrameCompressedSize <> nil);
@ZSTD_findDecompressedSize := GetProcAddress(DLLHandle,
'ZSTD_findDecompressedSize');
Assert(@ZSTD_findDecompressedSize <> nil);
@ZSTD_createCCtx := GetProcAddress(DLLHandle, 'ZSTD_createCCtx');
Assert(@ZSTD_createCCtx <> nil);
@ZSTD_freeCCtx := GetProcAddress(DLLHandle, 'ZSTD_freeCCtx');
Assert(@ZSTD_freeCCtx <> nil);
@ZSTD_createDCtx := GetProcAddress(DLLHandle, 'ZSTD_createDCtx');
Assert(@ZSTD_createDCtx <> nil);
@ZSTD_freeDCtx := GetProcAddress(DLLHandle, 'ZSTD_freeDCtx');
Assert(@ZSTD_freeDCtx <> nil);
@ZSTD_createCDict := GetProcAddress(DLLHandle, 'ZSTD_createCDict');
Assert(@ZSTD_createCDict <> nil);
@ZSTD_freeCDict := GetProcAddress(DLLHandle, 'ZSTD_freeCDict');
Assert(@ZSTD_freeCDict <> nil);
@ZSTD_compressCCtx := GetProcAddress(DLLHandle, 'ZSTD_compressCCtx');
Assert(@ZSTD_compressCCtx <> nil);
@ZSTD_createDDict := GetProcAddress(DLLHandle, 'ZSTD_createDDict');
Assert(@ZSTD_createDDict <> nil);
@ZSTD_freeDDict := GetProcAddress(DLLHandle, 'ZSTD_freeDDict');
Assert(@ZSTD_freeDDict <> nil);
@ZSTD_decompressDCtx := GetProcAddress(DLLHandle, 'ZSTD_decompressDCtx');
Assert(@ZSTD_decompressDCtx <> nil);
@ZSTD_compress_usingCDict := GetProcAddress(DLLHandle,
'ZSTD_compress_usingCDict');
Assert(@ZSTD_compress_usingCDict <> nil);
@ZSTD_decompress_usingDDict := GetProcAddress(DLLHandle,
'ZSTD_decompress_usingDDict');
Assert(@ZSTD_decompress_usingDDict <> nil);
@ZSTD_getParams := GetProcAddress(DLLHandle, 'ZSTD_getParams');
Assert(@ZSTD_getParams <> nil);
@ZSTD_initCStream := GetProcAddress(DLLHandle, 'ZSTD_initCStream');
Assert(@ZSTD_initCStream <> nil);
@ZSTD_initCStream_advanced := GetProcAddress(DLLHandle,
'ZSTD_initCStream_advanced');
Assert(@ZSTD_initCStream_advanced <> nil);
@ZSTD_compressStream := GetProcAddress(DLLHandle, 'ZSTD_compressStream');
Assert(@ZSTD_compressStream <> nil);
@ZSTD_flushStream := GetProcAddress(DLLHandle, 'ZSTD_flushStream');
Assert(@ZSTD_flushStream <> nil);
@ZSTD_endStream := GetProcAddress(DLLHandle, 'ZSTD_endStream');
Assert(@ZSTD_endStream <> nil);
@ZSTD_CStreamInSize := GetProcAddress(DLLHandle, 'ZSTD_CStreamInSize');
Assert(@ZSTD_CStreamInSize <> nil);
@ZSTD_CStreamOutSize := GetProcAddress(DLLHandle, 'ZSTD_CStreamOutSize');
Assert(@ZSTD_CStreamOutSize <> nil);
@ZSTD_createCCtxParams := GetProcAddress(DLLHandle,
'ZSTD_createCCtxParams');
Assert(@ZSTD_createCCtxParams <> nil);
@ZSTD_freeCCtxParams := GetProcAddress(DLLHandle, 'ZSTD_freeCCtxParams');
Assert(@ZSTD_freeCCtxParams <> nil);
@ZSTD_CCtxParams_reset := GetProcAddress(DLLHandle,
'ZSTD_CCtxParams_reset');
Assert(@ZSTD_CCtxParams_reset <> nil);
@ZSTD_CCtxParams_init := GetProcAddress(DLLHandle, 'ZSTD_CCtxParams_init');
Assert(@ZSTD_CCtxParams_init <> nil);
@ZSTD_CCtx_setParameter := GetProcAddress(DLLHandle,
'ZSTD_CCtx_setParameter');
Assert(@ZSTD_CCtx_setParameter <> nil);
@ZSTD_CCtx_setParametersUsingCCtxParams :=
GetProcAddress(DLLHandle, 'ZSTD_CCtx_setParametersUsingCCtxParams');
Assert(@ZSTD_CCtx_setParametersUsingCCtxParams <> nil);
DLLLoaded := Assigned(ZSTD_compress) and Assigned(ZSTD_decompress);
end
else
DLLLoaded := False;
@@ -247,9 +170,23 @@ begin
FreeLibrary(DLLHandle);
end;
const
DLLParam = '--zstd=';
var
I: Integer;
DLLFile: String;
initialization
Init;
DLLFile := 'libzstd.dll';
for I := 1 to ParamCount do
if ParamStr(I).StartsWith(DLLParam) then
begin
DLLFile := ParamStr(I).Substring(DLLParam.Length);
break;
end;
Init(DLLFile);
finalization