On Cygwin POSIX symbols in libc.a
are strong symbols (e.g. accept
):
$ nm /usr/lib/libc.a | grep 'accept' -w
0000000000000000 T accept
while on Linux they are weak symbols (e.g. accept
):
$ nm /usr/lib/x86_64-linux-gnu/libc.a |& grep 'accept' -w
accept.o:
0000000000000000 W accept
U accept
U accept
U accept
U accept
Note: having POSIX symbols in libc.a
may be a bit unexpected.
However, why in Cygwin's libc.a
POSIX symbols are strong symbols?
Example: If user has mylib.a
containing the definition of accept
and the mylib.a
goes after the libc.a
in the list of command line arguments, then the accept
from the libc.a
may be (and usually is) selected.
UPD. https://stackoverflow.com/a/2290838/1778275:
MSVC++ has
__declspec(selectany)
which covers part of the functionality of weak symbols.