Date: Wed, 16 Jan 2019 10:09:15 +0000 From: Lorenzo Salvadore <phascolarctos@protonmail.ch> To: FreeBSD Questions <freebsd-questions@freebsd.org> Subject: Re: libc : non-c specific functions! Message-ID: <k-axOVVk6Sx_F-JcO5p8LsoeoGNG3ylZpJzACBJoHtuNyRpUplKXnRlLDa0qqOivPXUQgEo9fED8BLhg-R22OKsYpBaPCXJ2C6Uw9DM9ZRc=@protonmail.ch> In-Reply-To: <201901160505.x0G558X1004475@sdf.org> References: <201901160505.x0G558X1004475@sdf.org>
next in thread | previous in thread | raw e-mail | index | archive | help
> is there any way to find out which functions in libc are non-c > specific, so for example if i had to implement a syslib in > assembly language, i could just avoid the "c" parts as they > would be irrelevant. > all of the above is hypothetical, i just want to know and learn. > something which this mailing list allows me to do effortlessly. Someone already answered about it, but I guess the answer was not clear enough. It would be easier to answer you if you told us what you know: which programming languages do you know for example? Are you developing some concrete project or are you only studying theory (it is pretty hard to study theory without practice in this subject)? Now, the answer to your question. C is a language to write softwares and libraries. What you write in C is called a source code: you understand the source code, the machine does not. Then you compile it using a software called a compiler (as gcc or clang): what you get is an object code in machine code; the machine understands it, you do not (well if you really want you can but it is very hard, impossible for average people). Then, after a third passage called linking (implicit in compilation for easy projects like "hello world= " printing programs), you get your library or software, in machine code. The final product - the library or software - is in machine code. Not in C, not in assembly, not in rust. That holds for libc too: it's language is machine code, at least in the compiled form on your system. When developers wrote its source code it was most probably written mainly in C and assembly (you can mix programming languages and often you need to), but in its compiled form on the system it is in machine code. 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. Hope this can help you. Lorenzo Salvadore.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?k-axOVVk6Sx_F-JcO5p8LsoeoGNG3ylZpJzACBJoHtuNyRpUplKXnRlLDa0qqOivPXUQgEo9fED8BLhg-R22OKsYpBaPCXJ2C6Uw9DM9ZRc=>