zlib icon indicating copy to clipboard operation
zlib copied to clipboard

Build ZLIB with fvisibility=hidden on Linux

Open cyrillicw opened this issue 2 years ago • 3 comments

There is a macro ZEXPORT which as I understand should set appropriate visibility for functions that should be accessed from outside. But for Linux definition of ZEXPORT is empty so when I set fvisibility=hidden the functions become invisible

cyrillicw avatar Mar 02 '23 15:03 cyrillicw

You can build with your own ZEXPORT MACRO if you set fvisibility=hidden globally. But why you set fvisibility=hidden ?

fredgan avatar Mar 28 '23 12:03 fredgan

Oh, thank you, didn't think about the possibility of defining own ZEXPORT. Thank you! I use fvisibility=hidden because according to https://gcc.gnu.org/wiki/Visibility this can significantly influence the size of the executable, compilation time, etc.

cyrillicw avatar Mar 28 '23 17:03 cyrillicw

ZEXPORT for some reason is placed in the middle of function declarations and definitions instead of at the beginning, which causes compiler to spit warnings and sometimes to ignore attribute.

uis246 avatar Apr 07 '24 22:04 uis246