diff options
| author | Marcos Magueta <maguetamarcos@gmail.com> | 2026-03-06 04:10:31 -0300 |
|---|---|---|
| committer | Marcos Magueta <maguetamarcos@gmail.com> | 2026-03-06 04:10:31 -0300 |
| commit | 5bbbbc976d25859082014f3720b82bcd2d05a2f0 (patch) | |
| tree | 91c8a230260006156ef58fcc004775d1387de94e /lib/core_functions.ml | |
| parent | 1f084d995444683e2885beb6e12eeee6df1241d3 (diff) | |
| download | Sakura-5bbbbc976d25859082014f3720b82bcd2d05a2f0.tar.gz Sakura-5bbbbc976d25859082014f3720b82bcd2d05a2f0.zip | |
encode relations on module base
Diffstat (limited to '')
| -rw-r--r-- | lib/core_functions.ml | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/lib/core_functions.ml b/lib/core_functions.ml index 083e0cf..059cd14 100644 --- a/lib/core_functions.ml +++ b/lib/core_functions.ml @@ -1,11 +1,27 @@ +(* open Ctypes *) + module Types = Types_generated module Functions (F : Ctypes.FOREIGN) = struct - open F + (* open F *) + open Ctypes_static + + let os_extension = + if Sys.os_type = "Unix" then + let ic = Unix.open_process_in "uname" in + let uname = input_line ic in + let () = close_in ic in + if uname = "Darwin" then "dylib" else "so" + else "dll" + + let libmerklecpp = + Dl.dlopen ~flags:[ RTLD_GLOBAL; RTLD_NOW ] + ~filename: + (Sys.getenv "LIBRELATIONAL_ENGINE_LIB_PATH" + ^ "/librelational_engine." ^ os_extension) let compute_hash = - foreign "compute_hash" - (F.(@->) (Ctypes.ptr Ctypes.char) - (F.(@->) Ctypes.string (F.returning Ctypes.void))) + Foreign.foreign ~from:libmerklecpp "compute_hash" + (ptr char @-> Ctypes.string @-> returning void) end |
