Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
Using Tk extensions under caml/labltk
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2000-03-24 (15:50)
From: Jacques Garrigue <garrigue@k...>
Subject: Re: Using Tk extensions under caml/labltk
From: Michael Hohn <>

> Recently, I needed to use the BLT extension to Tk.  Since all my data comes
> from ocaml, and there is a fair amount of data, I wrote a simple C interface.
> Below are the steps I took under ocaml-2.04.
> My questions are:
> 1.  Why is tcl_eval not exported by default (in protocol.mli)?  I
>     don't like Tcl much, but 
>     for trivial commands like "package require blt", I don't see a
>     problem with direct string evaluation.

You can do something equivalent by using the Protocol.tkEval command.
You just have to preparse your string. This is basically how the whole
library is built.
  val tkEval : tkArgs array -> string

>     Also, it would be nice to have some interactive control over
>     caml programs compiled to native code; wouldn't Tcl work well
>     for this?

Doesn't sound like a very good idea to me.
I don't know what are your exact needs, but you might have a look at
what is done inside efuns
There Fabrice Le Feissant has a bytecode interpreter written in Caml,
allowing dynamic loading of caml bytecode inside a native application.
This is reasonably efficient. 

> 2.  Apparently, most high-level widget interfaces are defined in
>     otherlibs/labltk/Widgets.src, with special routines in 
>     otherlibs/labltk/builtin/* and general low level support in 
>     otherlibs/labltk/support.

This approach also allows to define interfaces for other libraries
independently. I don't know very well how this works, so somedbody more
competent should answer, but for instance there was already an
interface for BLT in the camltk41 version distributed with MMM.

Jacques Garrigue      Kyoto University     garrigue at
		<A HREF=>JG</A>