diff options
| author | Marcos Magueta <maguetamarcos@gmail.com> | 2025-01-19 21:50:01 -0300 |
|---|---|---|
| committer | Marcos Magueta <maguetamarcos@gmail.com> | 2025-01-19 21:50:01 -0300 |
| commit | 919b7f1a81982533ff4ab33730c68313690c2b77 (patch) | |
| tree | 81ca1f9779a8af22d505cbc34fe2cba5a3c9c72b /lib/core_functions.ml | |
| parent | fbb9318eede78561970676c9d98d82e3851aeae5 (diff) | |
| download | Sakura-919b7f1a81982533ff4ab33730c68313690c2b77.tar.gz Sakura-919b7f1a81982533ff4ab33730c68313690c2b77.zip | |
cleanup and format
Diffstat (limited to 'lib/core_functions.ml')
| -rw-r--r-- | lib/core_functions.ml | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/lib/core_functions.ml b/lib/core_functions.ml index 7fdf1f1..6919f2f 100644 --- a/lib/core_functions.ml +++ b/lib/core_functions.ml @@ -5,19 +5,26 @@ module Types = Types_generated module Functions (F : Ctypes.FOREIGN) = struct (* 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" + 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.foreign ~from:libmerklecpp "compute_hash" (ptr char @-> Ctypes.string @-> returning void) - let merkle_generate_root = Foreign.foreign ~from:libmerklecpp "merkle_generate_root" (ptr Ctypes.string @-> int @-> ptr char @-> returning void) + Dl.dlopen ~flags:[ RTLD_GLOBAL; RTLD_NOW ] + ~filename: + (Sys.getenv "LIBRELATIONAL_ENGINE_LIB_PATH" + ^ "/librelational_engine." ^ os_extension) + + let compute_hash = + Foreign.foreign ~from:libmerklecpp "compute_hash" + (ptr char @-> Ctypes.string @-> returning void) + + let merkle_generate_root = + Foreign.foreign ~from:libmerklecpp "merkle_generate_root" + (ptr Ctypes.string @-> int @-> ptr char @-> returning void) end |
