1 (***********************************************************************)
3 (* MLTk, Tcl/Tk interface of Objective Caml *)
5 (* Francois Rouaix, Francois Pessaux, Jun Furuse and Pierre Weis *)
6 (* projet Cristal, INRIA Rocquencourt *)
7 (* Jacques Garrigue, Kyoto University RIMS *)
9 (* Copyright 2002 Institut National de Recherche en Informatique et *)
10 (* en Automatique and Kyoto University. All rights reserved. *)
11 (* This file is distributed under the terms of the GNU Library *)
12 (* General Public License, with the special exception on linking *)
13 (* described in file LICENSE found in the Objective Caml source tree. *)
15 (***********************************************************************)
17 (* $Id: slave.ml 4745 2002-04-26 12:16:26Z furuse $ *)
19 (* The code run on initialisation, in addition to normal Tk code
20 * NOTE: camltk has not fully been initialised yet
22 external tcl_eval : string -> string
24 let tcl_command s = ignore (tcl_eval s);;
28 List.iter Dynlink.loadfile args
30 (* Default modules include everything from
31 let default_modules = []
34 (* [caml::run foo.cmo .. bar.cmo] is now available from Tcl *)
37 (* Make it unsafe by default, with everything available *)
38 Dynlink.allow_unsafe_modules true;
39 Dynlink.add_interfaces [] [];
40 let s = register_callback Widget.dummy dynload in
41 tcl_command (sprintf "proc caml::run {l} {camlcb %s l}" s)
44 Printexc.print init ()
46 (* A typical master program would then
48 * # during initialisation, "foo" was registered as a tcl procedure
50 * # proceed with some Tcl code calling foo