xref: /haiku/docs/user/posix/_libroot.dox (revision 344ded80d400028c8f561b4b876257b94c12db4a)
1b966e837SAdrien Destugues/*
22a2e7ad5SPulkoMandy * Copyright 2019-2024 Haiku, Inc. All rights reserved.
3b966e837SAdrien Destugues * Distributed under the terms of the MIT License.
4b966e837SAdrien Destugues *
5b966e837SAdrien Destugues * Authors:
6b966e837SAdrien Destugues *		Adrien Destugues, pulkomandy@pulkomandy.tk
7b966e837SAdrien Destugues */
8b966e837SAdrien Destugues
9b966e837SAdrien Destugues/*!
10*344ded80SPulkoMandy\defgroup libroot C, POSIX, GNU and BSD functions
11b966e837SAdrien Destugues
12b966e837SAdrien DestuguesHaiku implements a standard library containing the standard functions from C
13b966e837SAdrien Destugues(https://www.iso.org/standard/29237.html) and POSIX
14b966e837SAdrien Destugues(https://pubs.opengroup.org/onlinepubs/9699919799/). These functions are
15b966e837SAdrien Destuguesavailable in libroot, which is linked in by default.
16b966e837SAdrien Destugues
17b966e837SAdrien DestuguesFor convenience and POSIX compatibility, empty "m" and "pthread" libraries are
182a2e7ad5SPulkoMandyalso provided, but the math and thread functions are also defined in libroot. However, this is
192a2e7ad5SPulkoMandycurrently not the case for "rt" and "trace" (both also part of the standard libraries required
202a2e7ad5SPulkoMandyin POSIX).
21b966e837SAdrien Destugues
22b966e837SAdrien DestuguesThe C library also contains a number of GNU and BSD extensions to the C and
23b966e837SAdrien DestuguesPOSIX standards. The BSD extensions are enabled by default unless a specific
24b966e837SAdrien Destuguesversion of the C standard is requested from the compiler command line (for
25b966e837SAdrien Destuguesexample by using the --std=c99 switch). In case you want to set the compiler
26b966e837SAdrien Destuguesto strict C99 but still use these extensions, you need to define _DEFAULT_SOURCE
272aad295eSNiels Sascha Reedijk(with a \#define preprocessor directive, or from the command line).
28b966e837SAdrien Destugues
29b966e837SAdrien DestuguesThe GNU extensions are not enabled by default, but can be enabled by defining
30b966e837SAdrien Destugues_GNU_SOURCE.
31b966e837SAdrien Destugues
32b966e837SAdrien DestuguesThe GNU and BSD extensions are in a separate library, so the -lbsd linker flag
33b966e837SAdrien Destuguesmay be needed to use them.
34b966e837SAdrien Destugues
352a2e7ad5SPulkoMandyOn the other hand, network socket functions (socket, connect, bind, accept, ...) are provided in
362a2e7ad5SPulkoMandya separate library, libnetwork.so. To use these functions you will need to use the -lnetwork
372a2e7ad5SPulkoMandylinker command line switch (instead of the POSIX specified -lxnet).
382a2e7ad5SPulkoMandy
39b966e837SAdrien Destugues*/
40