On Unix builds, all of the symbols were exported, including all the private helpers and variables, polluting the global namespace and making it too easy to overlap with similar names in other libraries / object files within the same app.
On Windows builds, none of the symbols were exported in the DLL, making it impossible to use SEP.
This PR changes both of those things by switching to default hidden visibility and explicitly exporting only symbols in sep.h (that is, public API).
Before (Unix)
$ nm -D --defined-only lxbuild/libsep.so.0.6.0
000000000021c278 B __bss_start
000000000021c278 D _edata
000000000021c680 B _end
000000000001838c T _fini
00000000000023f8 T _init
0000000000005650 T addobjdeep
0000000000003f10 T allocdeblend
0000000000002d30 T analyse
0000000000002990 T analysemthresh
00000000000055c0 T apply_mask_line
00000000000055a0 T arraybuffer_free
0000000000005440 T arraybuffer_init
00000000000053c0 T arraybuffer_readline
0000000000013dc0 T backguess
0000000000013bb0 T backhisto
0000000000013590 T backstat
0000000000004990 T belong
00000000000153b0 T bkg_line_flt_internal
000000000000c720 T circle_segment
0000000000005af0 T clean
0000000000017490 T convert_array_byt
00000000000171f0 T convert_array_dbl
0000000000017060 T convert_array_flt
0000000000017310 T convert_array_int
0000000000017050 T convert_byt
0000000000017020 T convert_dbl
0000000000017030 T convert_flt
0000000000017040 T convert_int
00000000000060c0 T convert_to_catalog
00000000000037a0 T convolve
0000000000004a10 T createsubmap
0000000000004ae0 T deblend
000000000021c268 D extract_pixstack
00000000000142b0 T filterback
0000000000018320 T fqmedian
0000000000005f30 T free_catalog_fields
0000000000003ec0 T freedeblend
0000000000004060 T gatherup
0000000000017f40 T get_array_converter
0000000000018250 T get_array_subtractor
0000000000017fd0 T get_array_writer
0000000000017eb0 T get_converter
0000000000008d10 T lutz
0000000000008a00 T lutzalloc
0000000000008950 T lutzfree
0000000000008c50 T lutzsort
0000000000014f40 T makebackspline
0000000000003b50 T matched_filter
000000000021c260 D nsonmax
000000000021c678 B plistexist_cdvalue
000000000021c664 B plistexist_thresh
000000000021c670 B plistexist_var
0000000000005a40 T plistinit
000000000021c660 B plistoff_cdvalue
000000000021c668 B plistoff_thresh
000000000021c66c B plistoff_value
000000000021c674 B plistoff_var
000000000021c67c B plistsize
0000000000002bc0 T preanalyse
0000000000018230 T put_errdetail
00000000000167c0 T sep_background
0000000000016280 T sep_bkg_array
0000000000016780 T sep_bkg_free
00000000000151d0 T sep_bkg_global
00000000000151e0 T sep_bkg_globalrms
0000000000016060 T sep_bkg_line
0000000000016020 T sep_bkg_line_flt
00000000000151f0 T sep_bkg_pix
00000000000163f0 T sep_bkg_rmsarray
0000000000016170 T sep_bkg_rmsline
0000000000016040 T sep_bkg_rmsline_flt
0000000000016660 T sep_bkg_subarray
0000000000016560 T sep_bkg_subline
0000000000006df0 T sep_catalog_free
000000000000df60 T sep_ellipse_axes
000000000000e260 T sep_ellipse_coeffs
0000000000006e10 T sep_extract
0000000000012070 T sep_flux_radius
0000000000018200 T sep_get_errdetail
0000000000018020 T sep_get_errmsg
00000000000053b0 T sep_get_extract_pixstack
0000000000003eb0 T sep_get_sub_object_limit
0000000000012240 T sep_kron_radius
0000000000012900 T sep_set_ellipse
00000000000053a0 T sep_set_extract_pixstack
0000000000003ea0 T sep_set_sub_object_limit
000000000000f8e0 T sep_sum_circann
0000000000011200 T sep_sum_circann_multi
000000000000e330 T sep_sum_circle
00000000000103b0 T sep_sum_ellipann
000000000000ec70 T sep_sum_ellipse
000000000021c270 D sep_version_string
0000000000012c30 T sep_windowed
00000000000058a0 T sortit
0000000000017940 T subtract_array_dbl
0000000000017ab0 T subtract_array_flt
0000000000017c90 T subtract_array_int
0000000000008cd0 T update
0000000000017630 T write_array_dbl
0000000000017750 T write_array_int
After (Unix)
$ nm -D --defined-only lxbuild-pub/libsep.so.0.6.0
000000000021e130 B __bss_start
000000000021e130 D _edata
000000000021e540 B _end
0000000000019bcc T _fini
0000000000001190 T _init
0000000000017ff0 T sep_background
00000000000155b0 T sep_bkg_array
0000000000017fb0 T sep_bkg_free
00000000000144c0 T sep_bkg_global
00000000000144d0 T sep_bkg_globalrms
0000000000015350 T sep_bkg_line
00000000000144e0 T sep_bkg_pix
0000000000016380 T sep_bkg_rmsarray
0000000000015480 T sep_bkg_rmsline
0000000000017250 T sep_bkg_subarray
0000000000017150 T sep_bkg_subline
0000000000005c90 T sep_catalog_free
000000000000d250 T sep_ellipse_axes
000000000000d550 T sep_ellipse_coeffs
0000000000005cb0 T sep_extract
0000000000011360 T sep_flux_radius
0000000000019b10 T sep_get_errdetail
0000000000019930 T sep_get_errmsg
0000000000003fe0 T sep_get_extract_pixstack
00000000000029c0 T sep_get_sub_object_limit
0000000000011530 T sep_kron_radius
0000000000011bf0 T sep_set_ellipse
0000000000003fd0 T sep_set_extract_pixstack
00000000000029b0 T sep_set_sub_object_limit
000000000000ebd0 T sep_sum_circann
00000000000104f0 T sep_sum_circann_multi
000000000000d620 T sep_sum_circle
000000000000f6a0 T sep_sum_ellipann
000000000000df60 T sep_sum_ellipse
000000000021e128 D sep_version_string
0000000000011f20 T sep_windowed
Before (Windows)
> dumpbin /exports .\vsbuild\Release\sep.dll
Microsoft (R) COFF/PE Dumper Version 14.16.27043.0
Copyright (C) Microsoft Corporation. All rights reserved.
Dump of file .\vsbuild\Release\sep.dll
File Type: DLL
Summary
1000 .data
1000 .rdata
1000 .reloc
1000 .rsrc
1000 .text
After (Windows)
> dumpbin /exports .\vsbuild-pub\Release\sep.dll
Microsoft (R) COFF/PE Dumper Version 14.16.27043.0
Copyright (C) Microsoft Corporation. All rights reserved.
Dump of file .\vsbuild-pub\Release\sep.dll
File Type: DLL
Section contains the following exports for sep.dll
00000000 characteristics
FFFFFFFF time date stamp
0.00 version
1 ordinal base
31 number of functions
31 number of names
ordinal hint RVA name
1 0 0000D960 sep_background
2 1 0000E080 sep_bkg_array
3 2 0000E1E0 sep_bkg_free
4 3 0000E220 sep_bkg_global
5 4 0000E230 sep_bkg_globalrms
6 5 0000E240 sep_bkg_line
7 6 0000E340 sep_bkg_pix
8 7 0000E490 sep_bkg_rmsarray
9 8 0000E5F0 sep_bkg_rmsline
10 9 0000E6F0 sep_bkg_subarray
11 A 0000E800 sep_bkg_subline
12 B 00004360 sep_catalog_free
13 C 00007430 sep_ellipse_axes
14 D 00007580 sep_ellipse_coeffs
15 E 00004390 sep_extract
16 F 00007630 sep_flux_radius
17 10 0000F020 sep_get_errdetail
18 11 0000F060 sep_get_errmsg
19 12 000056F0 sep_get_extract_pixstack
20 13 00003220 sep_get_sub_object_limit
21 14 000078B0 sep_kron_radius
22 15 00007D00 sep_set_ellipse
23 16 00005700 sep_set_extract_pixstack
24 17 00003230 sep_set_sub_object_limit
25 18 00007E20 sep_sum_circann
26 19 00008620 sep_sum_circann_multi
27 1A 00008EF0 sep_sum_circle
28 1B 00009640 sep_sum_ellipann
29 1C 0000A020 sep_sum_ellipse
30 1D 00015008 sep_version_string
31 1E 0000A8B0 sep_windowed
Summary
1000 .data
4000 .rdata
1000 .reloc
1000 .rsrc
10000 .text
Previously, there were two problems with linkage:
This PR changes both of those things by switching to default hidden visibility and explicitly exporting only symbols in
sep.h
(that is, public API).Before (Unix)
After (Unix)
Before (Windows)
After (Windows)