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