diff options
author | Ben Sima <ben@bsima.me> | 2023-08-17 21:21:07 -0400 |
---|---|---|
committer | Ben Sima <ben@bsima.me> | 2023-08-17 22:44:04 -0400 |
commit | aac50fb4a0eea25a057bb2d7ebe80961c542a2a5 (patch) | |
tree | b6e6a26cd7dec9937003aa33ec6f0875be2ee99d /Biz/Bild/Example.c | |
parent | cc6aac612e36da3c9b9b4e47fc16ed512a79f2d9 (diff) |
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.
Diffstat (limited to 'Biz/Bild/Example.c')
-rw-r--r-- | Biz/Bild/Example.c | 15 |
1 files changed, 12 insertions, 3 deletions
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 <sodium.h> + +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; } |