xref: /aosp_15_r20/external/zstd/lib/dll/example/README.md (revision 01826a4963a0d8a59bc3812d29bdf0fb76416722)
1*01826a49SYabin Cui# ZSTD Windows binary package
2*01826a49SYabin Cui
3*01826a49SYabin Cui## The package contents
4*01826a49SYabin Cui
5*01826a49SYabin Cui- `zstd.exe` : Command Line Utility, supporting gzip-like arguments
6*01826a49SYabin Cui- `dll\libzstd.dll` : The ZSTD dynamic library (DLL)
7*01826a49SYabin Cui- `dll\libzstd.lib` : The import library of the ZSTD dynamic library (DLL) for Visual C++
8*01826a49SYabin Cui- `example\` : The example of usage of the ZSTD library
9*01826a49SYabin Cui- `include\` : Header files required by the ZSTD library
10*01826a49SYabin Cui- `static\libzstd_static.lib` : The static ZSTD library (LIB)
11*01826a49SYabin Cui
12*01826a49SYabin Cui## Usage of Command Line Interface
13*01826a49SYabin Cui
14*01826a49SYabin CuiCommand Line Interface (CLI) supports gzip-like arguments.
15*01826a49SYabin CuiBy default CLI takes an input file and compresses it to an output file:
16*01826a49SYabin Cui
17*01826a49SYabin Cui    Usage: zstd [arg] [input] [output]
18*01826a49SYabin Cui
19*01826a49SYabin CuiThe full list of commands for CLI can be obtained with `-h` or `-H`. The ratio can
20*01826a49SYabin Cuibe improved with commands from `-3` to `-16` but higher levels also have slower
21*01826a49SYabin Cuicompression. CLI includes in-memory compression benchmark module with compression
22*01826a49SYabin Cuilevels starting from `-b` and ending with `-e` with iteration time of `-i` seconds.
23*01826a49SYabin CuiCLI supports aggregation of parameters i.e. `-b1`, `-e18`, and `-i1` can be joined
24*01826a49SYabin Cuiinto `-b1e18i1`.
25*01826a49SYabin Cui
26*01826a49SYabin Cui## The example of usage of static and dynamic ZSTD libraries with gcc/MinGW
27*01826a49SYabin Cui
28*01826a49SYabin CuiUse `cd example` and `make` to build `fullbench-dll` and `fullbench-lib`.
29*01826a49SYabin Cui`fullbench-dll` uses a dynamic ZSTD library from the `dll` directory.
30*01826a49SYabin Cui`fullbench-lib` uses a static ZSTD library from the `lib` directory.
31*01826a49SYabin Cui
32*01826a49SYabin Cui## Using ZSTD DLL with gcc/MinGW
33*01826a49SYabin Cui
34*01826a49SYabin CuiThe header files from `include\` and the dynamic library `dll\libzstd.dll`
35*01826a49SYabin Cuiare required to compile a project using gcc/MinGW.
36*01826a49SYabin CuiThe dynamic library has to be added to linking options.
37*01826a49SYabin CuiIt means that if a project that uses ZSTD consists of a single `test-dll.c`
38*01826a49SYabin Cuifile it should be linked with `dll\libzstd.dll`. For example:
39*01826a49SYabin Cui
40*01826a49SYabin Cui    gcc $(CFLAGS) -Iinclude\ test-dll.c -o test-dll dll\libzstd.dll
41*01826a49SYabin Cui
42*01826a49SYabin CuiThe compiled executable will require ZSTD DLL which is available at `dll\libzstd.dll`.
43*01826a49SYabin Cui
44*01826a49SYabin Cui## The example of usage of static and dynamic ZSTD libraries with Visual C++
45*01826a49SYabin Cui
46*01826a49SYabin CuiOpen `example\fullbench-dll.sln` to compile `fullbench-dll` that uses a
47*01826a49SYabin Cuidynamic ZSTD library from the `dll` directory. The solution works with Visual C++
48*01826a49SYabin Cui2010 or newer. When one will open the solution with Visual C++ newer than 2010
49*01826a49SYabin Cuithen the solution will be upgraded to the current version.
50*01826a49SYabin Cui
51*01826a49SYabin Cui## Using ZSTD DLL with Visual C++
52*01826a49SYabin Cui
53*01826a49SYabin CuiThe header files from `include\` and the import library `dll\libzstd.lib`
54*01826a49SYabin Cuiare required to compile a project using Visual C++.
55*01826a49SYabin Cui
56*01826a49SYabin Cui1. The path to header files should be added to `Additional Include Directories` that can
57*01826a49SYabin Cui   be found in project properties `C/C++` then `General`.
58*01826a49SYabin Cui2. The import library has to be added to `Additional Dependencies` that can
59*01826a49SYabin Cui   be found in project properties `Linker` then `Input`.
60*01826a49SYabin Cui   If one will provide only the name `libzstd.lib` without a full path to the library
61*01826a49SYabin Cui   the directory has to be added to `Linker\General\Additional Library Directories`.
62*01826a49SYabin Cui
63*01826a49SYabin CuiThe compiled executable will require ZSTD DLL which is available at `dll\libzstd.dll`.
64