Automatically merge a shared socket library in * nix

I learn network programming through source code examples from this link http://cs.baylor.edu/~donahoo/practical/CSockets/textcode.html . At compile time, it’s just interesting why in Solaris I need to manually link the socket library and nsl in the make file, but when on a Linux machine should I not do this?

+4
source share
2 answers

Documentation Used: http://developers.sun.com/solaris/articles/solaris_linux_app.html

This is because linux libc, glibc ( -lc , which by default is associated with all programs) includes part of the POSIX socket; and nis/nis+ dynamic libraries in linux are loaded dynamically also with libc.

But there are many libraries on Solaris with basic functions that are not in libc. (libc, libucb, libmalloc, libsocket, libxnet, etc.). I think it was a design solution that allowed the user to bind only those parts of the API that he needed.

In linux, there are also some basic libraries outside of libc: libaio, librt, libm.

With a separate library, it is easier to update only certain parts of the system; and it is possible to have several implementations (for example, to provide greater compatibility / workarounds with older versions of UNIX) of some libraries that coexist on the same system.

This issue is discussed a lot, for example. http://web.archiveorange.com/archive/v/KcxCHdLNpD6NANxmAt3b http://mail.opensolaris.org/pipermail/opensolaris-code/2007-January/010316.html

seriously consider folding libnsl and libsocket into libc.

It would be convenient to ONLY move the current POSIX system and other standards-based functionality (Unix98, etc.) libnsl + libsocket functions in libc and save all materials for compatibility in libnsl / libsocket to avoid libc bloating with 20 years of Unix backward compatibility

+6
source

Since on Linux the entire network API is implemented in libc.so , which is associated with each C program by default, and in Solaris in separate libraries.

+2
source

Source: https://habr.com/ru/post/1399389/


All Articles