Skip to content

Commit f42ed89

Browse files
committed
Explore (un)marshaling binary data from the compiler
dune build marshal_test.bc.js node ./_build/default/marshal_test.bc.js
1 parent ad3e1d8 commit f42ed89

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

dune

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
(dirs jscomp res_syntax)
1+
(executable (name marshal_test) (modes js))

marshal_test.ml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
let marshal v = Marshal.to_bytes v []
2+
3+
let unmarshal x = Obj.magic(Marshal.from_bytes x 0)
4+
5+
let s = marshal (1,2,3)
6+
let v = unmarshal s
7+

0 commit comments

Comments
 (0)