xref: /haiku/docs/user/posix/_libroot.dox (revision dd2a1e350b303b855a50fd64e6cb55618be1ae6a)
1/*
2 * Copyright 2019-2024 Haiku, Inc. All rights reserved.
3 * Distributed under the terms of the MIT License.
4 *
5 * Authors:
6 *		Adrien Destugues, pulkomandy@pulkomandy.tk
7 */
8
9/*!
10\page libroot C, POSIX, GNU and BSD functions
11
12Haiku implements a standard library containing the standard functions from C
13(https://www.iso.org/standard/29237.html) and POSIX
14(https://pubs.opengroup.org/onlinepubs/9699919799/). These functions are
15available in libroot, which is linked in by default.
16
17For convenience and POSIX compatibility, empty "m" and "pthread" libraries are
18also provided, but the math and thread functions are also defined in libroot. However, this is
19currently not the case for "rt" and "trace" (both also part of the standard libraries required
20in POSIX).
21
22The C library also contains a number of GNU and BSD extensions to the C and
23POSIX standards. The BSD extensions are enabled by default unless a specific
24version of the C standard is requested from the compiler command line (for
25example by using the --std=c99 switch). In case you want to set the compiler
26to strict C99 but still use these extensions, you need to define _DEFAULT_SOURCE
27(with a \#define preprocessor directive, or from the command line).
28
29The GNU extensions are not enabled by default, but can be enabled by defining
30_GNU_SOURCE.
31
32The GNU and BSD extensions are in a separate library, so the -lbsd linker flag
33may be needed to use them.
34
35On the other hand, network socket functions (socket, connect, bind, accept, ...) are provided in
36a separate library, libnetwork.so. To use these functions you will need to use the -lnetwork
37linker command line switch (instead of the POSIX specified -lxnet).
38
39*/
40