mirror of
https://github.com/facebook/zstd.git
synced 2025-10-17 00:07:08 -04:00
Even with -fvisibility=hidden added to CFLAGS, any symbol which is given a default visibility attribute ends up exported in the dynamic library. This happens through zstd_internal.h which defines ..._STATIC_LINKING_ONLY before including various header files, and is included for example in lib/common/pool.c. To avoid this, this patch distinguishes static and non-static APIs, by using ZSTDLIB_API only for the latter, and introducing ZSTDLIB_STATIC_API for the former. For now, both are exported, but non-static APIs can be hidden by overriding the definition ZSTDLIB_STATIC_API. lib/Makefile is modified to allow this using make CPPFLAGS_DYNLIB=-DZSTDLIB_STATIC_API=ZSTDLIB_HIDDEN In addition, API declarations are dropped from zstd_compress.c (they aren't needed there). Signed-off-by: Stephen Kitt <steve@sk2.org>