zlib-ng / minizip-ng

Fork of the popular zip manipulation library found in the zlib distribution.
Other
1.24k stars 434 forks source link

Windows: DLL export mz functions in mz_zip.h #475

Open jimpark opened 4 years ago

jimpark commented 4 years ago

On Linux and macOS, I can link dynamically to minizip and still access these symbols because they are exported by default. On Windows, they are not exported. Only the compatibility layer is exported. I'd like to move to start using the mz functions on all three platforms. Can we decorate the mz functions with MZ_EXPORT?

nmoinvaz commented 4 years ago

It should be possible to call cmake with -DCMAKE_WINDOWS_EXPORT_ALL_SYMBOLS=ON.

jimpark commented 4 years ago

Yes, it's just not consistent with the other header files that do have the export macro. If that's the solution, I'd suggest adding it directly to the CMakeLists.txt. It has no effect in linux or macOS but makes the shared library work on Windows. (One thing to note is that this CMake option does not export variables -- though I don't think we need to worry about it in minizip.)

zedxxx commented 4 years ago

+1 for MZ_EXPORT

Currently dll compiled with mingw exports all symbols by default and there is a lot of "garbage" (functions from zlib etc). Adding export directive should fix this problem and we will have exported only mz_ functions.

Here is a current dumpbin output:

Microsoft (R) COFF/PE Dumper Version 14.16.27026.1
Copyright (C) Microsoft Corporation.  All rights reserved.

Dump of file libminizip.dll

File Type: DLL

  Section contains the following exports for libminizip.dll

    00000000 characteristics
    5ED04684 time date stamp Fri May 29 02:17:24 2020
        0.00 version
           1 ordinal base
         463 number of functions
         463 number of names

    ordinal hint RVA      name

          1    0 00029820 BZ2_blockSort
          2    1 00021600 BZ2_bsInitWrite
          3    2 00021010 BZ2_bzBuffToBuffCompress
          4    3 00021130 BZ2_bzBuffToBuffDecompress
          5    4 0001EE50 BZ2_bzCompress
          6    5 0001EFC0 BZ2_bzCompressEnd
          7    6 0001EC00 BZ2_bzCompressInit
          8    7 0001F190 BZ2_bzDecompress
          9    8 00020180 BZ2_bzDecompressEnd
         10    9 0001F050 BZ2_bzDecompressInit
         11    A 00020CB0 BZ2_bzRead
         12    B 00020C10 BZ2_bzReadClose
         13    C 00020F80 BZ2_bzReadGetUnused
         14    D 00020810 BZ2_bzReadOpen
         15    E 000203A0 BZ2_bzWrite
         16    F 000207C0 BZ2_bzWriteClose
         17   10 00020560 BZ2_bzWriteClose64
         18   11 00020210 BZ2_bzWriteOpen
         19   12 0001EB80 BZ2_bz__AssertH__fail
         20   13 00021330 BZ2_bzclose
         21   14 00021270 BZ2_bzdopen
         22   15 00021410 BZ2_bzerror
         23   16 00021320 BZ2_bzflush
         24   17 00021240 BZ2_bzlibVersion
         25   18 00021250 BZ2_bzopen
         26   19 00021290 BZ2_bzread
         27   1A 000212E0 BZ2_bzwrite
         28   1B 00021620 BZ2_compressBlock
         29   1C 0002C220 BZ2_crc32Table
         30   1D 000252F0 BZ2_decompress
         31   1E 00029D90 BZ2_hbAssignCodes
         32   1F 00029DF0 BZ2_hbCreateDecodeTables
         33   20 000299B0 BZ2_hbMakeCodeLengths
         34   21 0001F160 BZ2_indexIntoF
         35   22 0002C620 BZ2_rNums
         36   23 00034300 _dist_code
         37   24 00034200 _length_code
         38   25 0001D2F0 _tr_align
         39   26 0001D2E0 _tr_flush_bits
         40   27 0001D3D0 _tr_flush_block
         41   28 0001D0F0 _tr_init
         42   29 0001D1D0 _tr_stored_block
         43   2A 0001DA70 _tr_tally
         44   2B 0001DFF0 adler32
         45   2C 0001E000 adler32_combine
         46   2D 0001E020 adler32_combine64
         47   2E 0001DC40 adler32_z
         48   2F 0000C2FC bz_internal_error
         49   30 00015490 crc32
         50   31 00015740 crc32_combine
         51   32 00015760 crc32_combine64
         52   33 00015730 crc32_z
         53   34 000172C0 deflate
         54   35 000171C0 deflateBound
         55   36 00018900 deflateCopy
         56   37 000184E0 deflateEnd
         57   38 00016D50 deflateGetDictionary
         58   39 000185C0 deflateInit2_
         59   3A 000188B0 deflateInit_
         60   3B 000182F0 deflateParams
         61   3C 00017000 deflatePending
         62   3D 00017060 deflatePrime
         63   3E 00016EF0 deflateReset
         64   3F 00016DE0 deflateResetKeep
         65   40 00016B00 deflateSetDictionary
         66   41 00016FC0 deflateSetHeader
         67   42 00017160 deflateTune
         68   43 00033400 deflate_copyright
         69   44 00015480 get_crc_table
         70   45 000190A0 inflate
         71   46 0001BA20 inflateCodesUsed
         72   47 0001B760 inflateCopy
         73   48 0001B2C0 inflateEnd
         74   49 0001B330 inflateGetDictionary
         75   4A 0001B4A0 inflateGetHeader
         76   4B 00018EF0 inflateInit2_
         77   4C 00018FF0 inflateInit_
         78   4D 0001B9C0 inflateMark
         79   4E 00019020 inflatePrime
         80   4F 00018DE0 inflateReset
         81   50 00018E30 inflateReset2
         82   51 00018D20 inflateResetKeep
         83   52 0001B3D0 inflateSetDictionary
         84   53 0001B4F0 inflateSync
         85   54 0001B710 inflateSyncPoint
         86   55 0001B930 inflateUndermine
         87   56 0001B970 inflateValidate
         88   57 00034080 inflate_copyright
         89   58 0001E040 inflate_fast
         90   59 0001BA70 inflate_table
         91   5A 0000D084 lzma_alloc
         92   5B 0000D0C3 lzma_alloc_zero
         93   5C 0000CDB4 lzma_alone_decoder
         94   5D 0000CA78 lzma_alone_decoder_init
         95   5E 0000D021 lzma_alone_encoder
         96   5F 0000D150 lzma_bufcpy
         97   60 0000C972 lzma_check_finish
         98   61 0000C970 lzma_check_init
         99   62 0000C944 lzma_check_is_supported
        100   63 0000C959 lzma_check_size
        101   64 0000C971 lzma_check_update
        102   65 0000D323 lzma_code
        103   66 0000C974 lzma_crc32
        104   67 0002D100 lzma_crc32_table
        105   68 0000D585 lzma_end
        106   69 0002F140 lzma_fastpos
        107   6A 0000D728 lzma_filter_encoder_is_supported
        108   6B 0000D127 lzma_free
        109   6C 0000D604 lzma_get_check
        110   6D 0000D5C8 lzma_get_progress
        111   6E 0000DA47 lzma_lz_decoder_init
        112   6F 0000DBC0 lzma_lz_decoder_memusage
        113   70 0000DBD2 lzma_lz_decoder_uncompressed
        114   71 0000E0B2 lzma_lz_encoder_init
        115   72 0000E058 lzma_lz_encoder_memusage
        116   73 00012590 lzma_lzma_decoder_create
        117   74 00012665 lzma_lzma_decoder_init
        118   75 000126ED lzma_lzma_decoder_memusage
        119   76 000126D0 lzma_lzma_decoder_memusage_nocheck
        120   77 00012ECF lzma_lzma_encode
        121   78 00013609 lzma_lzma_encoder_create
        122   79 0001372F lzma_lzma_encoder_init
        123   7A 00013758 lzma_lzma_encoder_memusage
        124   7B 0001342A lzma_lzma_encoder_reset
        125   7C 0001268E lzma_lzma_lclppb_decode
        126   7D 000137CF lzma_lzma_lclppb_encode
        127   7E 00013869 lzma_lzma_optimum_fast
        128   7F 00013D84 lzma_lzma_optimum_normal
        129   80 0001518C lzma_lzma_preset
        130   81 00012709 lzma_lzma_props_decode
        131   82 00013800 lzma_lzma_props_encode
        132   83 0000D672 lzma_memlimit_get
        133   84 0000D6C4 lzma_memlimit_set
        134   85 0000D620 lzma_memusage
        135   86 0000EBD9 lzma_mf_bt2_find
        136   87 0000EC6C lzma_mf_bt2_skip
        137   88 0000ECE9 lzma_mf_bt3_find
        138   89 0000EE73 lzma_mf_bt3_skip
        139   8A 0000EF33 lzma_mf_bt4_find
        140   8B 0000F18C lzma_mf_bt4_skip
        141   8C 0000E6B7 lzma_mf_find
        142   8D 0000E748 lzma_mf_hc3_find
        143   8E 0000E89F lzma_mf_hc3_skip
        144   8F 0000E912 lzma_mf_hc4_find
        145   90 0000EB47 lzma_mf_hc4_skip
        146   91 0000E2ED lzma_mf_is_supported
        147   92 00013833 lzma_mode_is_supported
        148   93 0000D748 lzma_mt_block_size
        149   94 0000D1E7 lzma_next_end
        150   95 0000D234 lzma_next_filter_init
        151   96 0000D19B lzma_next_filter_update
        152   97 0000D7AE lzma_properties_encode
        153   98 0000D77A lzma_properties_size
        154   99 00031300 lzma_rc_prices
        155   9A 0000D28B lzma_strm_init
        156   9B 0000D078 lzma_version_number
        157   9C 0000D07E lzma_version_string
        158   9D 000014F0 mz_crypt_crc32_update
        159   9E 000018E7 mz_dir_make
        160   9F 00001996 mz_file_get_crc
        161   A0 0000B027 mz_os_close_dir
        162   A1 0000AA70 mz_os_file_exists
        163   A2 0000ADED mz_os_get_file_attribs
        164   A3 0000AB83 mz_os_get_file_date
        165   A4 0000AACA mz_os_get_file_size
        166   A5 0000B05A mz_os_is_dir
        167   A6 0000B1C2 mz_os_is_symlink
        168   A7 0000B126 mz_os_make_dir
        169   A8 0000B226 mz_os_make_symlink
        170   A9 0000B507 mz_os_ms_time
        171   AA 0000AEAC mz_os_open_dir
        172   AB 0000A98E mz_os_rand
        173   AC 0000AF8F mz_os_read_dir
        174   AD 0000B300 mz_os_read_symlink
        175   AE 0000A9D4 mz_os_rename
        176   AF 0000AE50 mz_os_set_file_attribs
        177   B0 0000ACAF mz_os_set_file_date
        178   B1 0000A70F mz_os_unicode_string_create
        179   B2 0000A7AF mz_os_unicode_string_delete
        180   B3 0000B0BB mz_os_unlink
        181   B4 0000A7C1 mz_os_utf8_string_create
        182   B5 0000A8AB mz_os_utf8_string_create_from_unicode
        183   B6 0000A96A mz_os_utf8_string_delete
        184   B7 000014F8 mz_path_append_slash
        185   B8 00001537 mz_path_combine
        186   B9 00001657 mz_path_compare_wc
        187   BA 0000161F mz_path_convert_slashes
        188   BB 000018AA mz_path_get_filename
        189   BC 000015F5 mz_path_has_slash
        190   BD 00001869 mz_path_remove_extension
        191   BE 00001821 mz_path_remove_filename
        192   BF 000015C3 mz_path_remove_slash
        193   C0 000016FA mz_path_resolve
        194   C1 00002D2E mz_stream_buffered_close
        195   C2 00002DA8 mz_stream_buffered_create
        196   C3 00002DE5 mz_stream_buffered_delete
        197   C4 00002D96 mz_stream_buffered_error
        198   C5 00002E5B mz_stream_buffered_get_interface
        199   C6 00002838 mz_stream_buffered_is_open
        200   C7 00002E0D mz_stream_buffered_open
        201   C8 0000284A mz_stream_buffered_read
        202   C9 00002AD4 mz_stream_buffered_seek
        203   CA 00002CB9 mz_stream_buffered_tell
        204   CB 000029B9 mz_stream_buffered_write
        205   CC 0000C288 mz_stream_bzip_close
        206   CD 0000BFF1 mz_stream_bzip_create
        207   CE 0000C037 mz_stream_bzip_delete
        208   CF 0000BE33 mz_stream_bzip_error
        209   D0 0000C2F6 mz_stream_bzip_get_interface
        210   D1 0000BE3E mz_stream_bzip_get_prop_int64
        211   D2 0000BE08 mz_stream_bzip_is_open
        212   D3 0000BEF2 mz_stream_bzip_open
        213   D4 0000C05F mz_stream_bzip_read
        214   D5 0000BE2D mz_stream_bzip_seek
        215   D6 0000BEAB mz_stream_bzip_set_prop_int64
        216   D7 0000BE24 mz_stream_bzip_tell
        217   D8 0000C258 mz_stream_bzip_write
        218   D9 000025A0 mz_stream_close
        219   DA 00001E6A mz_stream_copy
        220   DB 00001DD3 mz_stream_copy_stream
        221   DC 00001E9B mz_stream_copy_stream_to_end
        222   DD 00001F2B mz_stream_copy_to_end
        223   DE 000027E4 mz_stream_create
        224   DF 00002803 mz_stream_delete
        225   E0 000025E5 mz_stream_error
        226   E1 00002032 mz_stream_find
        227   E2 000022CC mz_stream_find_reverse
        228   E3 00002794 mz_stream_get_interface
        229   E4 000027A2 mz_stream_get_prop_int64
        230   E5 00001B37 mz_stream_is_open
        231   E6 0000C8D9 mz_stream_lzma_close
        232   E7 0000C77B mz_stream_lzma_create
        233   E8 0000C7D6 mz_stream_lzma_delete
        234   E9 0000C32B mz_stream_lzma_error
        235   EA 0000C93C mz_stream_lzma_get_interface
        236   EB 0000C336 mz_stream_lzma_get_prop_int64
        237   EC 0000C300 mz_stream_lzma_is_open
        238   ED 0000C422 mz_stream_lzma_open
        239   EE 0000C623 mz_stream_lzma_read
        240   EF 0000C325 mz_stream_lzma_seek
        241   F0 0000C3A6 mz_stream_lzma_set_prop_int64
        242   F1 0000C31C mz_stream_lzma_tell
        243   F2 0000C8A9 mz_stream_lzma_write
        244   F3 00002E81 mz_stream_mem_close
        245   F4 00002FC6 mz_stream_mem_create
        246   F5 00002F87 mz_stream_mem_delete
        247   F6 000030B1 mz_stream_mem_error
        248   F7 00003115 mz_stream_mem_get_buffer
        249   F8 000030CB mz_stream_mem_get_buffer_at
        250   F9 0000313F mz_stream_mem_get_buffer_at_current
        251   FA 00003167 mz_stream_mem_get_buffer_length
        252   FB 00003193 mz_stream_mem_get_interface
        253   FC 00002E64 mz_stream_mem_is_open
        254   FD 0000300F mz_stream_mem_open
        255   FE 00002E84 mz_stream_mem_read
        256   FF 00002F17 mz_stream_mem_seek
        257  100 000030B4 mz_stream_mem_set_buffer
        258  101 00003177 mz_stream_mem_set_buffer_limit
        259  102 00003185 mz_stream_mem_set_grow_size
        260  103 00002E75 mz_stream_mem_tell
        261  104 00003041 mz_stream_mem_write
        262  105 00001B19 mz_stream_open
        263  106 0000B6EB mz_stream_os_close
        264  107 0000B714 mz_stream_os_create
        265  108 0000B756 mz_stream_os_delete
        266  109 0000B576 mz_stream_os_error
        267  10A 0000B8EA mz_stream_os_get_interface
        268  10B 0000B560 mz_stream_os_is_open
        269  10C 0000B7EF mz_stream_os_open
        270  10D 0000B581 mz_stream_os_read
        271  10E 0000B77E mz_stream_os_seek
        272  10F 0000B661 mz_stream_os_tell
        273  110 0000B5F1 mz_stream_os_write
        274  111 00001A53 mz_stream_raw_close
        275  112 00001AAF mz_stream_raw_create
        276  113 00001AF1 mz_stream_raw_delete
        277  114 00002772 mz_stream_raw_error
        278  115 00001A56 mz_stream_raw_get_prop_int64
        279  116 00001D35 mz_stream_raw_is_open
        280  117 00001A50 mz_stream_raw_open
        281  118 00001BAD mz_stream_raw_read
        282  119 00002020 mz_stream_raw_seek
        283  11A 00001A8C mz_stream_raw_set_prop_int64
        284  11B 00001F9F mz_stream_raw_tell
        285  11C 00001CF3 mz_stream_raw_write
        286  11D 00001B56 mz_stream_read
        287  11E 0000274A mz_stream_read_int64
        288  11F 000026D0 mz_stream_read_uint16
        289  120 0000270D mz_stream_read_uint32
        290  121 0000275E mz_stream_read_uint64
        291  122 00002696 mz_stream_read_uint8
        292  123 00001FAE mz_stream_seek
        293  124 00002784 mz_stream_set_base
        294  125 000027C3 mz_stream_set_prop_int64
        295  126 000038A9 mz_stream_split_close
        296  127 00003280 mz_stream_split_create
        297  128 00003226 mz_stream_split_delete
        298  129 0000326E mz_stream_split_error
        299  12A 000038DE mz_stream_split_get_interface
        300  12B 000031B5 mz_stream_split_get_prop_int64
        301  12C 0000319C mz_stream_split_is_open
        302  12D 00003562 mz_stream_split_open
        303  12E 00003719 mz_stream_split_read
        304  12F 00003673 mz_stream_split_seek
        305  130 000031FA mz_stream_split_set_prop_int64
        306  131 0000364A mz_stream_split_tell
        307  132 000037A4 mz_stream_split_write
        308  133 00001F55 mz_stream_tell
        309  134 00001C37 mz_stream_write
        310  135 00001DA1 mz_stream_write_int64
        311  136 00001D68 mz_stream_write_uint16
        312  137 00001D89 mz_stream_write_uint32
        313  138 00001DBA mz_stream_write_uint64
        314  139 00001D47 mz_stream_write_uint8
        315  13A 0000BD8D mz_stream_zlib_close
        316  13B 0000BC30 mz_stream_zlib_create
        317  13C 0000BC80 mz_stream_zlib_delete
        318  13D 0000B91B mz_stream_zlib_error
        319  13E 0000BE01 mz_stream_zlib_get_interface
        320  13F 0000B929 mz_stream_zlib_get_prop_int64
        321  140 0000B8F0 mz_stream_zlib_is_open
        322  141 0000B9E4 mz_stream_zlib_open
        323  142 0000BB08 mz_stream_zlib_read
        324  143 0000B915 mz_stream_zlib_seek
        325  144 0000B99C mz_stream_zlib_set_prop_int64
        326  145 0000B90C mz_stream_zlib_tell
        327  146 0000BD5D mz_stream_zlib_write
        328  147 00004516 mz_zip_attrib_convert
        329  148 000045B2 mz_zip_attrib_is_dir
        330  149 00004667 mz_zip_attrib_is_symlink
        331  14A 0000447B mz_zip_attrib_posix_to_win32
        332  14B 000044D0 mz_zip_attrib_win32_to_posix
        333  14C 000063FB mz_zip_close
        334  14D 00003FF8 mz_zip_create
        335  14E 00004036 mz_zip_delete
        336  14F 00004A7C mz_zip_dosdate_to_time_t
        337  150 00004A39 mz_zip_dosdate_to_tm
        338  151 000063D0 mz_zip_entry_close
        339  152 0000634E mz_zip_entry_close_raw
        340  153 000043C5 mz_zip_entry_get_info
        341  154 000043F1 mz_zip_entry_get_local_info
        342  155 00004607 mz_zip_entry_is_dir
        343  156 000042C1 mz_zip_entry_is_open
        344  157 000046BC mz_zip_entry_is_symlink
        345  158 000042DE mz_zip_entry_read
        346  159 0000480C mz_zip_entry_read_close
        347  15A 000053C0 mz_zip_entry_read_open
        348  15B 00004420 mz_zip_entry_set_extrafield
        349  15C 0000435C mz_zip_entry_write
        350  15D 0000605D mz_zip_entry_write_close
        351  15E 00007AE4 mz_zip_entry_write_open
        352  15F 00004795 mz_zip_extrafield_contains
        353  160 0000470D mz_zip_extrafield_find
        354  161 000049B6 mz_zip_extrafield_read
        355  162 000049FC mz_zip_extrafield_write
        356  163 00004201 mz_zip_get_cd_mem_stream
        357  164 0000405E mz_zip_get_comment
        358  165 0000429D mz_zip_get_disk_number_with_cd
        359  166 00004459 mz_zip_get_entry
        360  167 00004252 mz_zip_get_number_entry
        361  168 0000418D mz_zip_get_stream
        362  169 00004113 mz_zip_get_version_madeby
        363  16A 00005575 mz_zip_goto_entry
        364  16B 000055CD mz_zip_goto_first_entry
        365  16C 000055FC mz_zip_goto_next_entry
        366  16D 00007F83 mz_zip_locate_entry
        367  16E 00005678 mz_zip_locate_first_entry
        368  16F 00005647 mz_zip_locate_next_entry
        369  170 00007E8A mz_zip_ntfs_to_unix_time
        370  171 00006A5F mz_zip_open
        371  172 00007EE8 mz_zip_path_compare
        372  173 00008069 mz_zip_reader_close
        373  174 000092B6 mz_zip_reader_create
        374  175 000092EE mz_zip_reader_delete
        375  176 00008181 mz_zip_reader_entry_close
        376  177 00008454 mz_zip_reader_entry_get_first_hash
        377  178 00008340 mz_zip_reader_entry_get_hash
        378  179 00008528 mz_zip_reader_entry_get_info
        379  17A 000082F1 mz_zip_reader_entry_has_sign
        380  17B 00008AA1 mz_zip_reader_entry_is_dir
        381  17C 000080ED mz_zip_reader_entry_open
        382  17D 0000802E mz_zip_reader_entry_read
        383  17E 00008B74 mz_zip_reader_entry_save
        384  17F 00008F49 mz_zip_reader_entry_save_buffer
        385  180 0000900B mz_zip_reader_entry_save_buffer_length
        386  181 00008CD8 mz_zip_reader_entry_save_file
        387  182 00008AC8 mz_zip_reader_entry_save_process
        388  183 000091E9 mz_zip_reader_get_comment
        389  184 000091B0 mz_zip_reader_get_raw
        390  185 000091CB mz_zip_reader_get_zip_cd
        391  186 00009296 mz_zip_reader_get_zip_handle
        392  187 00008192 mz_zip_reader_goto_first_entry
        393  188 0000820D mz_zip_reader_goto_next_entry
        394  189 00008050 mz_zip_reader_is_open
        395  18A 00008288 mz_zip_reader_locate_entry
        396  18B 00008760 mz_zip_reader_open
        397  18C 000089CD mz_zip_reader_open_buffer
        398  18D 000087C5 mz_zip_reader_open_file
        399  18E 00008856 mz_zip_reader_open_file_in_memory
        400  18F 0000904A mz_zip_reader_save_all
        401  190 00009216 mz_zip_reader_set_encoding
        402  191 00009282 mz_zip_reader_set_entry_cb
        403  192 00009238 mz_zip_reader_set_overwrite_cb
        404  193 00009194 mz_zip_reader_set_password
        405  194 0000924C mz_zip_reader_set_password_cb
        406  195 00009180 mz_zip_reader_set_pattern
        407  196 00009260 mz_zip_reader_set_progress_cb
        408  197 00009274 mz_zip_reader_set_progress_interval
        409  198 000091A2 mz_zip_reader_set_raw
        410  199 00009227 mz_zip_reader_set_sign_required
        411  19A 00008566 mz_zip_reader_unzip_cd
        412  19B 000041B7 mz_zip_set_cd_stream
        413  19C 0000408B mz_zip_set_comment
        414  19D 00004171 mz_zip_set_data_descriptor
        415  19E 00004281 mz_zip_set_disk_number_with_cd
        416  19F 0000422B mz_zip_set_number_entry
        417  1A0 00004155 mz_zip_set_recover
        418  1A1 00004138 mz_zip_set_version_madeby
        419  1A2 00005784 mz_zip_time_t_to_dos_date
        420  1A3 000056C1 mz_zip_time_t_to_tm
        421  1A4 0000570A mz_zip_tm_to_dosdate
        422  1A5 00007EC6 mz_zip_unix_to_ntfs_time
        423  1A6 00009B44 mz_zip_writer_add
        424  1A7 00009D00 mz_zip_writer_add_buffer
        425  1A8 00009DA1 mz_zip_writer_add_file
        426  1A9 00009C7E mz_zip_writer_add_info
        427  1AA 0000A007 mz_zip_writer_add_path
        428  1AB 00009AC4 mz_zip_writer_add_process
        429  1AC 000096A1 mz_zip_writer_close
        430  1AD 0000A29C mz_zip_writer_copy_from_reader
        431  1AE 0000A665 mz_zip_writer_create
        432  1AF 0000A6AA mz_zip_writer_delete
        433  1B0 00009400 mz_zip_writer_entry_close
        434  1B1 00009339 mz_zip_writer_entry_open
        435  1B2 0000803F mz_zip_writer_entry_write
        436  1B3 0000A45F mz_zip_writer_get_raw
        437  1B4 0000A645 mz_zip_writer_get_zip_handle
        438  1B5 00009320 mz_zip_writer_is_open
        439  1B6 0000990A mz_zip_writer_open
        440  1B7 00009760 mz_zip_writer_open_file
        441  1B8 0000994D mz_zip_writer_open_file_in_memory
        442  1B9 0000A47D mz_zip_writer_set_aes
        443  1BA 0000A4E5 mz_zip_writer_set_certificate
        444  1BB 0000A43D mz_zip_writer_set_comment
        445  1BC 0000A4A0 mz_zip_writer_set_compress_level
        446  1BD 0000A48E mz_zip_writer_set_compress_method
        447  1BE 0000A62B mz_zip_writer_set_entry_cb
        448  1BF 0000A4B2 mz_zip_writer_set_follow_links
        449  1C0 0000A5CC mz_zip_writer_set_overwrite_cb
        450  1C1 0000A42C mz_zip_writer_set_password
        451  1C2 0000A5E6 mz_zip_writer_set_password_cb
        452  1C3 0000A600 mz_zip_writer_set_progress_cb
        453  1C4 0000A61A mz_zip_writer_set_progress_interval
        454  1C5 0000A44E mz_zip_writer_set_raw
        455  1C6 0000A4C3 mz_zip_writer_set_store_links
        456  1C7 0000A4D4 mz_zip_writer_set_zip_cd
        457  1C8 00009459 mz_zip_writer_zip_cd
        458  1C9 0001DB30 zError
        459  1CA 00034C00 z_errmsg
        460  1CB 0001DB50 zcalloc
        461  1CC 0001DB70 zcfree
        462  1CD 0001DB20 zlibCompileFlags
        463  1CE 0001DB10 zlibVersion

  Summary

        1000 .CRT
        1000 .bss
        1000 .data
        4000 .edata
        7000 .eh_frame
        1000 .idata
        A000 .rdata
        1000 .reloc
       2B000 .text
        1000 .tls
zedxxx commented 4 years ago

And one more thing: MZ_EXPORT should be used with all exported functions from all mz_xxx.h headers, not only from mz_zip.h.

nmoinvaz commented 4 years ago

Those extra functions are bzip, lzma, and zlib. I can easily see a scenario where somebody might want to use the zlib that was compiled with minizip. Lzma and bzip2 not so much.

zedxxx commented 4 years ago

What about to make it optional? If EXPORT_ALL_SYMBOLS not defined then define MZ_EXPORT and export only mz_ functions.

dr-dba commented 4 years ago

I am also struggling with getting minizip.DLLfor windows (not exe), no luck meanwhile Tried with CMake and VS2017

SpaceIm commented 3 years ago

Shouldn't _WINDOWS macro be replaced by _WIN32 here: https://github.com/zlib-ng/minizip-ng/blob/1593060ecf093411f1f20f655e50992913c6d5b9/mz.h#L150-L154

nmoinvaz commented 3 years ago

@SpaceIm Can you please explain why you think it should be changed?

SpaceIm commented 3 years ago

AFAIK, _WINDOWS definition doesn't exist (or it's not standard on Windows compilers), _WIN32 should be used to detect windows.

This simple macro should be sufficient:

#ifndef MZ_EXPORTS
#define MZ_EXPORT
#elif defined(_WIN32)
#define MZ_EXPORT __declspec(dllexport)
#else
#define MZ_EXPORT __attribute__ ((visibility ("default")))
#endif

__declspec(dllimport) can be omitted at consume time for minizip-ng, there are no global symbols.

Moreover, MZ_EXPORT should be put in front of all functions declarations in public headers (all headers actually, since they are all installed). Currently it's missing everywhere, except in mz_compat.h.

Finally, C_VISIBILITY_PRESET hidden should be added to properties of minizip target.

I've a PR more or less ready if you want.

Symbol visibility issue was detected while packaging minizip-ng in public repository of conan: https://github.com/conan-io/conan-center-index/pull/5166#discussion_r611556588. For the moment, the workaround is to set CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON. The neater solution is to hide all symbols, and exports symbols of the API (not only with Visual Studio).

nmoinvaz commented 3 years ago

It appears _WINDOWS was added in Visual Studio .NET from what I read.

We would end up exposing almost all of the functions with MZ_EXPORT so it doesn't make much difference from CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS.

SpaceIm commented 3 years ago

_WINDOWS is not listed in https://docs.microsoft.com/en-us/cpp/preprocessor/predefined-macros?view=msvc-160, it's the first time I see this macro.

We would end up exposing almost all of the functions with MZ_EXPORT so it doesn't make much difference from CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS.

symbols of dependencies would be hidden.

uilianries commented 3 years ago

It appears _WINDOWS was added in Visual Studio .NET from what I read.

True, but it's not defined for all Windows compilers. _WIN32 is well supported and commonly used. I strongly suggest replacing _WINDOWS by _WIN32.

nmoinvaz commented 3 years ago

@uilianries if you want to do a PR for changing that #define I will accept it.

uilianries commented 3 years ago

@nmoinvaz It would be great, because it allow us using -DMZ_EXPORTS on Windows. CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS works but is ugly, it exports everything.

nmoinvaz commented 3 years ago

What i mean is only changing _WINDOWS to _WIN32. I still think there is a valid use case for exporting the third party libraries.

neheb commented 2 years ago

@jimpark my solution for meson is to use a custom def file: https://github.com/mesonbuild/wrapdb/blob/master/subprojects/packagefiles/minizip-ng/mz.def

IIRC I took all the functions found in docs only. Probably not enough.

edit: funny. vcpkg lists minizip-ng as static-only.

neheb commented 2 years ago

one issue I noticed is these functions:

mz_stream_bzip_create
mz_stream_lzma_create
mz_stream_zlib_create
mz_stream_zstd_create
mz_stream_wzaes_create

these functions are only selectively added to the dll depending on whether the specific mz_strm_x.c files are compiled in, which makes having a def file difficult.

I recently updated that def file. Can anyone confirm or deny that those are public facing APIs?

modbw commented 5 months ago

+1 on adding MZ_EXPORT to every public function. CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS dosn't work for me when cross compiling minizip-ng from linux to windows using cmake version 3.28.2.