From owner-freebsd-questions@freebsd.org Wed Jan 16 10:09:28 2019 Return-Path: Delivered-To: freebsd-questions@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 492D01481E47 for ; Wed, 16 Jan 2019 10:09:28 +0000 (UTC) (envelope-from phascolarctos@protonmail.ch) Received: from mail4.protonmail.ch (mail4.protonmail.ch [185.70.40.27]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "*.protonmail.ch", Issuer "QuoVadis Global SSL ICA G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E430694D76 for ; Wed, 16 Jan 2019 10:09:26 +0000 (UTC) (envelope-from phascolarctos@protonmail.ch) Date: Wed, 16 Jan 2019 10:09:15 +0000 To: FreeBSD Questions From: Lorenzo Salvadore Reply-To: Lorenzo Salvadore Subject: Re: libc : non-c specific functions! Message-ID: In-Reply-To: <201901160505.x0G558X1004475@sdf.org> References: <201901160505.x0G558X1004475@sdf.org> Feedback-ID: X6az_D2smWSR8MT5MHqXnWF0upxehDyHia7Id1cbayHNBUkRu3CIeusDsZHiivIIjmaKB1_OofpALrRUYjNz3w==:Ext:ProtonMail MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-1.2 required=7.0 tests=ALL_TRUSTED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on mail.protonmail.ch X-Rspamd-Queue-Id: E430694D76 X-Spamd-Bar: ------- X-Spamd-Result: default: False [-7.83 / 15.00]; HAS_REPLYTO(0.00)[phascolarctos@protonmail.ch]; R_SPF_ALLOW(-0.20)[+ip4:185.70.40.0/24]; TO_DN_ALL(0.00)[]; MX_GOOD(-0.01)[cached: mailsec.protonmail.ch]; DKIM_TRACE(0.00)[protonmail.ch:+]; DMARC_POLICY_ALLOW(-0.50)[protonmail.ch,quarantine]; NEURAL_HAM_SHORT(-0.98)[-0.982,0]; SUBJECT_ENDS_EXCLAIM(0.00)[]; RCVD_COUNT_ZERO(0.00)[0]; RCVD_IN_DNSWL_LOW(-0.10)[27.40.70.185.list.dnswl.org : 127.0.5.1]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:19905, ipnet:185.70.40.0/24, country:US]; IP_SCORE(-3.74)[ip: (-9.83), ipnet: 185.70.40.0/24(-4.89), asn: 19905(-3.91), country: US(-0.08)]; MID_RHS_MATCH_FROM(0.00)[]; DWL_DNSWL_NONE(0.00)[protonmail.ch.dwl.dnswl.org : 127.0.5.0]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; R_DKIM_ALLOW(-0.20)[protonmail.ch:s=default]; REPLYTO_EQ_FROM(0.00)[]; FROM_HAS_DN(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[text/plain]; RCPT_COUNT_ONE(0.00)[1]; RCVD_TLS_ALL(0.00)[] X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Jan 2019 10:09:28 -0000 > 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.