From aac50fb4a0eea25a057bb2d7ebe80961c542a2a5 Mon Sep 17 00:00:00 2001 From: Ben Sima Date: Thu, 17 Aug 2023 21:21:07 -0400 Subject: Nixify C build This is working with libsodium as an example. Its unfortunate that we need the extra ':arg -lsodium' but how else can I get the name of the library for linking? Is that something in the nix attr metadata? Anyway, an optimization for another day. --- Biz/Bild/Example.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'Biz/Bild/Example.c') diff --git a/Biz/Bild/Example.c b/Biz/Bild/Example.c index 9966dba..52ea9b9 100644 --- a/Biz/Bild/Example.c +++ b/Biz/Bild/Example.c @@ -1,6 +1,15 @@ -// : out helloworld.exe -void -main () +// : out examplesodium.exe +// : dep libsodium +// : arg -lsodium +#include + +int +main (void) { + if (sodium_init () < 0) + { + /* panic! the library couldn't be initialized; it is not safe to use */ + } printf ("Biz/Bild/Example.c: Hello world!\n"); + return 0; } -- cgit v1.2.3