aboutsummaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
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;
+}