blob: 39094cc9e1fa67a4e20daf4b7263e21325d77cd3 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
module Types = Types_generated
module Functions (F : Ctypes.FOREIGN) = struct
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.foreign ~from:libmerklecpp "compute_hash"
(ptr char @-> Ctypes.string @-> returning void)
end
|