Initial commit
Setup a nix flake for an ocaml setup with mruby dependency
This commit is contained in:
+20
@@ -0,0 +1,20 @@
|
||||
open Ctypes
|
||||
open Foreign
|
||||
|
||||
type mrb = unit ptr
|
||||
|
||||
let mrb : mrb typ = ptr void
|
||||
let mrb_open = foreign "mrb_open" (void @-> returning mrb)
|
||||
let mrb_close = foreign "mrb_close" (mrb @-> returning void)
|
||||
|
||||
let mrb_load_string =
|
||||
foreign "mrb_load_string" (mrb @-> string @-> returning void)
|
||||
|
||||
let () =
|
||||
let mrb_instance = mrb_open () in
|
||||
|
||||
print_endline "Executing Ruby code from OCaml:";
|
||||
let _ = mrb_load_string mrb_instance "puts 'hello1234'.match?(/hello\\d+/)" in
|
||||
|
||||
mrb_close mrb_instance;
|
||||
print_endline "mruby instance closed successfully."
|
||||
Reference in New Issue
Block a user