summaryrefslogtreecommitdiff
path: root/testsuite/tests/callback/minor_named.ml
blob: 77b5e0311886464bd9a5712c47b7e30eedc63041 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
(* TEST
 include unix;
 modules = "minor_named_.c";
 libunix;
 {
   bytecode;
 }{
   native;
 }
*)

(* Tests Callback.register and caml_named_value on a young object *)

external incr_ref : unit -> unit = "incr_ref"

let () =
  let r = ref 40 in
  Callback.register "incr_ref" r;
  incr_ref ();
  Gc.minor ();
  incr_ref ();
  Printf.printf "%d\n" !r