aboutsummaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
authorMarcos Magueta <maguetamarcos@gmail.com>2026-04-20 21:59:37 -0300
committerEstevan Castilho <tevo@riajuu.net>2026-04-29 23:30:21 +0000
commit35c7bf1ff874b0a75b810cf889692656d97abf76 (patch)
treedcb144e3523f88667081b953476a83723a27a146 /bin
parent4fdf3392868c72ff4c33b70d165a177e97f2fece (diff)
downloadSakura-35c7bf1ff874b0a75b810cf889692656d97abf76.tar.gz
Sakura-35c7bf1ff874b0a75b810cf889692656d97abf76.zip
bootstrap nix with c on dune
Diffstat (limited to 'bin')
-rw-r--r--bin/dune6
-rw-r--r--bin/main.c27
2 files changed, 33 insertions, 0 deletions
diff --git a/bin/dune b/bin/dune
index b559855..36633c1 100644
--- a/bin/dune
+++ b/bin/dune
@@ -4,3 +4,9 @@
(modules server)
(libraries relational_engine unix)
(modes byte exe))
+
+(rule
+ (targets main_c.exe)
+ (deps main.c)
+ (action
+ (bash "cc main.c -o main_c.exe $(pkg-config --cflags --libs lmdb)")))
diff --git a/bin/main.c b/bin/main.c
new file mode 100644
index 0000000..38abeee
--- /dev/null
+++ b/bin/main.c
@@ -0,0 +1,27 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <lmdb.h>
+
+int main(void) {
+ MDB_env *env;
+ int rc;
+
+ rc = mdb_env_create(&env);
+ if (rc) {
+ fprintf(stderr, "mdb_env_create failed: %s\n", mdb_strerror(rc));
+ return EXIT_FAILURE;
+ }
+
+ rc = mdb_env_open(env, "./testdb", MDB_NOSUBDIR, 0664);
+ if (rc) {
+ fprintf(stderr, "mdb_env_open failed: %s\n", mdb_strerror(rc));
+ mdb_env_close(env);
+ return EXIT_FAILURE;
+ }
+
+ printf("LMDB environment opened successfully.\n");
+ printf("LMDB version: %s\n", mdb_version(NULL, NULL, NULL));
+
+ mdb_env_close(env);
+ return EXIT_SUCCESS;
+}