Fix and make mruby work better
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
open Ctypes
|
||||
open Foreign
|
||||
|
||||
module Mrb_state = struct
|
||||
type t
|
||||
type mrb_ptr = t structure ptr
|
||||
|
||||
let typ : t structure typ = structure "mrb_state"
|
||||
let jmp = field typ "jmp" (ptr void)
|
||||
let c = field typ "c" (ptr void)
|
||||
let root_c = field typ "root_c" (ptr void)
|
||||
let globals = field typ "globals" (ptr void)
|
||||
let exc = field typ "exc" (ptr void)
|
||||
|
||||
(* as it builds by default on x86_64 linux *)
|
||||
let padding = field typ "padding" (array 24472 char)
|
||||
let () = seal typ
|
||||
|
||||
let has_error mrb_ptr =
|
||||
let exc_val = getf !@mrb_ptr exc in
|
||||
not (is_null exc_val)
|
||||
|
||||
let clear_error mrb_ptr = setf !@mrb_ptr exc null
|
||||
end
|
||||
Reference in New Issue
Block a user