Adding Metakit to Cloverleaf Tcl Lib

Homepage Clovertech Forums Read Only Archives Cloverleaf Cloverleaf Adding Metakit to Cloverleaf Tcl Lib

  • Creator
    Topic
  • #50192
    Jon Blanchard
    Participant

    I decided to install Metakit into the Cloverleaf environment, so I located the Mk4tcl.DLL file in $HCIROOTbin and the .tcl file in $HCIROOTtcllibMk4tcl.  The GDBM library is set up this way.

    How do I run a pkg_mkIndex to make the new addition available?  I know the format of the command and have run it several times with no response.

    Migration Consultant
    Coffee Regional Medical Center
    Eastern Time Zone

Viewing 1 reply thread
  • Author
    Replies
    • #65150
      Levy Lazarre
      Participant

      Jon,

      I assume that you are running Cloverleaf in the Windows environment since you are using a DLL.

      It’s not necessary to run the “pkg_mkIndex” command in order to use the  Metakit. There is a simpler way to do this. You can load the shared library directly into your Tcl application by using the command:

      load /Mk4tcl.DLL

      where is the complete (absolute) path where you installed the DLL.

      This replaces the “package require” command and you can start issuing your Metakit commands immediately.

      This has worked very well for me, both in Windows and Unix.

      However, if you prefer, you can also create the package index. Just change to the directory where you have installed the DLL, start your Tcl shell and issue the command:

      pkg_mkIndex .  

      (Of course, the “.” indicates the current directory)

      This will create the index file pkgIndex.tcl for you and now you can load the library in Tcl by issuing the command:

      package require Mk4tcl

      Hope this helps,

      Levy

    • #65151
      Charlie Bursell
      Participant

      The pkg_mkIndex command will work as you say but the package will not be found in the bin directory unless you lappend that directory to the global variable auto_path prior to issuing the package require command.

      Tcl will search through all of the auto_path directories plus one level deeper for packages.

      For packages, I normally put them in one of two places.

      If I want the package to be used in only one site I usually create a directory under the site tclprocs directory (I usually call mine lib) and place the package(s) and the pkgIndex file there.

      If I want a package to apply to all sites in the root I normally create a directory under $HCIROOT/tcl/lib of the same name as the package.  For example, Metakit.  I then place the package and the pkgIndex file there.

      I am well aware you can issue the pkg_mkIndex command from a Tcl shell.  You can do the same thing with the  auto_mkindex command to build a tclIndex but it is easier to use the mktclindex script provided.

      I have modified the mktclindex script to do packages and named it mkpkgindex.  The difference is, by default, it assumes files with suffix of .pkg as that is the suffix I put on my packages.  Like mktclindex you can override the defau;t by passing a  suffix like “*.tcl” or a complete file name like Metakit.dll when running the script.

      I think I have uploaded the script before but here it is again.  If on Unix, remove the .htc suffix and make sure the first line has the proper path.  I would recommend the script be put under $HCIROOT/contrib so it is available anywhere within the root.

      In this case, simply put the Metakit.dll file in a directory within your auto_path as described above and, from that directory, run the script like:  mkpgkindex Metakit.dll

Viewing 1 reply thread
  • The forum ‘Cloverleaf’ is closed to new topics and replies.

Forum Statistics

Registered Users
5,126
Forums
28
Topics
9,296
Replies
34,439
Topic Tags
287
Empty Topic Tags
10