Re: [wiki] Monocypher rocks!

From: NRK <>
Date: Sat, 24 Sep 2022 02:48:23 +0600


Wasn't subscribed to the wiki list, but I saw this thread on the archive
and wanted to chime in a bit.

On Mon Sep 12, 2022 at 9:09 PM CEST, Lancia Greggori wrote:
> How is it possible to write a C library with absolutely no dependency on
> libc?

For libraries it's not that difficult depending on the scope of the
library. One such library that I really like is optparse [0], it has no
dependency whatsoever.

The author of optparse also has a very nice article on how to write
minimalistic C libraries [1].

> Simply pass `-nostdlib' and do not include any standard headers.
> However, none of this is done in monocypher[1], thus it actually depends on
> libc (which isn't a problem).

The C standard defines 2 different types of execution environment [2],
"hosted" and "freestanding".

<stdint.h> and <stddef.h> are part of the freestanding environment [3]
thus there is no dependency on libc (freestanding headers are typically
provided by the compiler).


Received on Fri Sep 23 2022 - 22:48:23 CEST

This archive was generated by hypermail 2.3.0 : Fri Sep 23 2022 - 23:00:51 CEST