Created
December 17, 2015 16:17
-
-
Save SanderSpies/ed6b934dc8fdb6feb217 to your computer and use it in GitHub Desktop.
JSC in OCaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let context = createGlobalContext null in | |
let script = createStringWithUTF8CString "(function(){return 'Hi OCaml, this is your friend JavaScriptCore.';})();" in | |
let valueref = evaluateScript context script null null 0 null in | |
let result = valueToString context valueref null in | |
let ocaml_str = toOCamlString result in ( | |
print_string ocaml_str; | |
releaseString script; | |
releaseGlobalContext context; | |
releaseOCamlString ocaml_str);; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment