Date: Wed, 16 Jan 2019 11:39:08 +0100 From: Polytropon <freebsd@edvax.de> To: Lorenzo Salvadore <phascolarctos@protonmail.ch> Cc: Lorenzo Salvadore via freebsd-questions <freebsd-questions@freebsd.org> Subject: Re: libc : non-c specific functions! Message-ID: <20190116113908.2dd84e96.freebsd@edvax.de> In-Reply-To: <k-axOVVk6Sx_F-JcO5p8LsoeoGNG3ylZpJzACBJoHtuNyRpUplKXnRlLDa0qqOivPXUQgEo9fED8BLhg-R22OKsYpBaPCXJ2C6Uw9DM9ZRc=@protonmail.ch> References: <201901160505.x0G558X1004475@sdf.org> <k-axOVVk6Sx_F-JcO5p8LsoeoGNG3ylZpJzACBJoHtuNyRpUplKXnRlLDa0qqOivPXUQgEo9fED8BLhg-R22OKsYpBaPCXJ2C6Uw9DM9ZRc=@protonmail.ch>
next in thread | previous in thread | raw e-mail | index | archive | help
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". :-) -- Polytropon Magdeburg, Germany Happy FreeBSD user since 4.0 Andra moi ennepe, Mousa, ...
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20190116113908.2dd84e96.freebsd>