Re: Using Tk extensions under caml/labltk

From: Jacques Garrigue (garrigue@kurims.kyoto-u.ac.jp)
Date: Fri Mar 24 2000 - 09:10:08 MET

  • Next message: David Mentré: "labels & ocaml 3 & co."

    From: Michael Hohn <hohn@math.utah.edu>

    > 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
     http://pauillac.inria.fr/para/cdrom/prog/unix/efuns/eng.htm
    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
    ---------------------------------------------------------------------------
    Jacques Garrigue Kyoto University garrigue at kurims.kyoto-u.ac.jp
                    <A HREF=http://wwwfun.kurims.kyoto-u.ac.jp/~garrigue/>JG</A>



    This archive was generated by hypermail 2b29 : Fri Mar 24 2000 - 16:54:26 MET