aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorMarcos Magueta <maguetamarcos@gmail.com>2024-10-16 01:31:05 -0300
committerMarcos Magueta <maguetamarcos@gmail.com>2024-10-16 01:31:05 -0300
commite339fa975e21c1b589a8dfc6ac083aba2b0a6394 (patch)
tree556b4fd1873fd7ec900ccd736543b04a68b02572 /lib
parent0d01055df0b99bb696fb6a2e480513cebf8890a3 (diff)
downloadSakura-e339fa975e21c1b589a8dfc6ac083aba2b0a6394.tar.gz
Sakura-e339fa975e21c1b589a8dfc6ac083aba2b0a6394.zip
dune environment vars with flake and C++ interop with stubs
Diffstat (limited to '')
-rw-r--r--lib/dune10
-rw-r--r--lib/hello.ml1
-rw-r--r--lib/merklecpp_stubs.cpp15
3 files changed, 25 insertions, 1 deletions
diff --git a/lib/dune b/lib/dune
index 5d95cc5..3bc492f 100644
--- a/lib/dune
+++ b/lib/dune
@@ -1,2 +1,10 @@
(library
- (name relational_engine))
+ (name relational_engine)
+ (foreign_stubs
+ (language cxx)
+ (names merklecpp_stubs)
+ (flags
+ (:standard -lssl -lcrypto)
+ (-L %{env:LIBRESSL_LIB_PATH=})
+ (-I %{env:LIBRESSL_INCLUDE_PATH=})
+ (-I %{env:MERKLECPP_INCLUDE_PATH=}))))
diff --git a/lib/hello.ml b/lib/hello.ml
new file mode 100644
index 0000000..1a3a138
--- /dev/null
+++ b/lib/hello.ml
@@ -0,0 +1 @@
+external hello : unit -> int = "hello_ocaml"
diff --git a/lib/merklecpp_stubs.cpp b/lib/merklecpp_stubs.cpp
new file mode 100644
index 0000000..4ce427e
--- /dev/null
+++ b/lib/merklecpp_stubs.cpp
@@ -0,0 +1,15 @@
+#include <iostream>
+#include <merklecpp.h>
+
+void cpp_normal_function() {
+ std::cout << "HELLO OCAML! :)" << std::endl;
+}
+
+extern "C" {
+#include <caml/mlvalues.h>
+#include <caml/memory.h>
+ extern value hello_ocaml(value unit){
+ cpp_normal_function();
+ return 0;
+ }
+}