libc : non-c specific functions!

Polytropon freebsd at
Wed Jan 16 10:44:30 UTC 2019

A little addition:

On Wed, 16 Jan 2019 10:09:15 +0000, Lorenzo Salvadore via freebsd-questions wrote:
> The relation of libc with C is that it follows a standard which makes
> writing C programs very easily. If you have some experience in C you
> surely know the printf function: how the compiler knows what to do
> when you write it in a source code? It knows it because it is written in
> libc.

And to the compiler, it doesn't even matter in which source
language the machine code corresponding to printf() has been
written in. There is a defined format for libraries (for static
as well as dynamic use) which allows the compiler and linker
to create the appropriate "hooks" to call functions. It does
not matter if such a function has been written in C, in Rust,
or in assembly. In fact, parts of FreeBSD's libc have been
written in assembly (check for *.S files in /usr/src/lib/libc;
some parts are machine-dependent, others are not.

The _content_ of libc (as a concept different from the way
of creation of libc) is defined by the C standard, i. e.,
which functions, variables, or macros the standard requires.
This is where the name originates from. Do not confuse this
with statements like "the libc is written in C", or "the
libc is for programs written in C". :-)

Magdeburg, Germany
Happy FreeBSD user since 4.0
Andra moi ennepe, Mousa, ...

More information about the freebsd-questions mailing list