diff options
author | Nathan Moinvaziri <nathan@nathanm.com> | 2021-03-23 18:42:50 -0700 |
---|---|---|
committer | Hans Kristian Rosbach <hk-github@circlestorm.org> | 2021-03-26 09:23:47 +0100 |
commit | 40b380efc0922f05e52e0852aeabc076d0b01344 (patch) | |
tree | f6b312a558b7dd421851ca9d8ea0f027c42df2c8 | |
parent | 5fe25907ea1da498a75e4b842b9d97ca27acf1ed (diff) |
Added build differences between zlib-compat and zlib-ng native mode to porting doc.
-rw-r--r-- | PORTING.md | 30 |
1 files changed, 22 insertions, 8 deletions
@@ -1,5 +1,5 @@ Porting applications to use zlib-ng ------------------------------------ +=================================== Zlib-ng can be used/compiled in two different modes, that require some consideration by the application developer. @@ -14,11 +14,6 @@ ABI-compatible, meaning that you cannot simply replace the zlib library/dll files and expect the application to work. The application will need to be recompiled against the zlib-ng headers and libs to ensure full compatability. -Zlib-ng can be distinguished from other zlib implementations at compile-time -by checking for the existence of ZLIBNG_VERSION defined in the zlib.h header. - -Compile against the *zlib.h* provided by zlib-ng. - **Advantages:** - Easy to port to, since it only requires a recompile of the application and no changes to the application code. @@ -34,6 +29,13 @@ Compile against the *zlib.h* provided by zlib-ng. Cloudflares zlib forks. Doing this is not recommended since it makes it very hard to maintain compatibility over time. +**Build Considerations:** +- Compile against the *zlib.h* provided by zlib-ng +- Configuration header is named *zconf.h* +- Static library is *libz.a* on Unix and macOS, or *zlib.lib* on Windows +- Shared library is *libz.so* on Unix, *libz.dylib* on macOS, or *zlib1.dll* + on Windows +- Type `z_size_t` is *unsigned long* zlib-ng native mode ------------------- @@ -43,8 +45,6 @@ library, allowing applications to implement support and testing separately. The zlib-ng native has implemented some modernization and simplifications in its API, intended to make life easier for application developers. -Compile against *zlib-ng.h*. - **Advantages:** - Does not conflict with other zlib implementations, and can co-exist as a system library along with zlib. @@ -54,3 +54,17 @@ Compile against *zlib-ng.h*. **Disadvantages:** - Requires minor changes to applications to use the prefixed zlib-ng function calls and structs. Usually this means a small prefix `zng_` has to be added. + +**Build Considerations:** +- Compile against *zlib-ng.h* +- Configuration header is named *zconf-ng.h* +- Static library is *libz-ng.a* on Unix and macOS, or *zlib-ng.lib* on Windows +- Shared library is *libz-ng.so* on Unix, *libz-ng.dylib* on macOS, or + *zlib-ng2.dll* on Windows +- Type `z_size_t` is *size_t* + +zlib-ng compile-time detection +------------------------------ + +To distinguish zlib-ng from other zlib implementations at compile-time check for the +existence of `ZLIBNG_VERSION` defined in the zlib header. |