Skip to content

Commit

Permalink
Safer bindings to foreign values.
Browse files Browse the repository at this point in the history
  • Loading branch information
dboris committed Oct 31, 2024
1 parent ddf8c2f commit 28f577d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion inspect/dune
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
(executable
(name main)
(public_name inspect-rt)
(flags :standard -ccopt "-framework Cocoa")
; (flags :standard -ccopt "-framework Cocoa")
(libraries camlkit-base.runtime lib))
4 changes: 2 additions & 2 deletions lib/bridgesupport.ml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ let emit_const x =
if String.equal t "id" then
Printf.printf "let %s = new_string \"%s\"\n" safe_name name
else
Printf.printf "let %s = !@ (Foreign.foreign_value \"%s\" %s)\n" safe_name name t
Printf.printf "let %s = foreign_value_or_null \"%s\" %s\n" safe_name name t

let emit_enum x =
let name = Option.get (S.attribute "name" x)
Expand Down Expand Up @@ -212,7 +212,7 @@ let emit_func _fw x =
funcs := emit_inline_func name ty :: !funcs
| _ ->
funcs :=
Printf.sprintf "let %s = Foreign.foreign \"%s\" (%s)"
Printf.sprintf "let %s = Foreign.foreign ~stub:true \"%s\" (%s)"
(if is_upper (String.get name 0) then "_" ^ name else name)
name ty
(* ; emit_doc_comment ~search:true fw name ^ "\n" *)
Expand Down

0 comments on commit 28f577d

Please sign in to comment.