Andreas Rozek Hints for Reading List of Recent Changes Guestbook Entry Contact the Author  Deutsche Version  HomePage Previous Topic Next Topic  First Page of Current Topic Next Page Previous Page

Distributions for Win32 Platforms

Since neither an investigation within the internet nor a request posted to the Lua mailing list brought the desired result, the auther finally had to create the required TkLua distribution for Win32 platforms himself...

This web pages describes the author's effort to build Win32 distributions of Lua/LuaC 4.0, tolua, TkLua 4.0a1 and LuaSocket 1.4. Both the final distributions as well as any project and resource files for Microsoft 's Visual Studio 6.0 may be downloaded from here - the latter allow you to built the distribution yourself.

Surprisingly, "porting" Lua turned out to be easier than expected: all packages presented below are the result of an effort of little more than two full working days (with 7.5 hours each) - including the installation of Microsoft Visual Studio and the initial practice based on the help facility that comes with VC6!

The author's Lua distributions now also include recent bugfixes for Lua 4.0 (available from [10])

Please, also consider my "Hints for Reading" and the "List of Recent Changes".

Overview

The list of topics given below directly guides you to the desired information - just click on a topic of your choice:

Lua

This port of the Lua runtime system is based on the original source code [1] (including bugfixes from [10]), the "official" port for Win32 platforms [2] as well as project and resource files found in an "inofficial" port [3]. The distribution was built without any changes to the source code, everything the author had to do himself was to set up appropriate project files for Microsoft Visual Studio 6.0 and to write ".def" files containing the entry points for any Lua libraries (DLLs). Additionally, a Lua icon (Lua.ico) was taken from the "inofficial" port [3].

As a result of this effort, two libraries (LuaCore.dll and LuaLib.dll) and an executable (Lua.exe) were built - the latter may be invoked from a command line shell and runs any given stand-alone Lua script.

LuaC

Presumably, porting the Lua compiler LuaC would not have required any changes to the source code as well - however, the compiler seems to require far more library entry points than the runtime system. For the time being, these entry points have not yet been included in the abovementioned ".def" files. As a consequence, the Lua compiler (LuaC.exe) is not yet available from the author (you may, however, use the one found in the "official" port [2] instead).

tolua

The actual implementation of Lua's interface to Tcl/Tk (TkLua) uses "tolua" to simplify the construction of any "glue" code which maps Lua values to C/C++ structures or functions and vice-versa. Thus, a successful port of TkLua first requires to port tolua as well. Fortunately again, a tolua "port" does not require any changes to the source code - all the author had to do was to apply the patches described in [6] and to write a ".def" file for the tolua library.

As a result of this effort, a single executable (toLua.exe) and a separately loadable library (toLuaLib.dll) were built.

TkLua

TkLua implements a comfortable Tcl/Tk interface for Lua programs. For a successful build certain Tcl/Tk ".lib" files must be available - the simplest way to get them is by installation of the Tcl/Tk sources. Upon compilation of the Tcl/Tk distribution, both the required ".lib" files and the corresponding libraries are available - this helps to avoid any problems due to incompatibilities (between ".lib" files and the corresponding libraries) from the very beginning.

Since Lua has been built to be invoked from a command line shell only, TkLua requires its own Windows executable (in addition to the sheer port which - again - does not require any changes to the source code). The author has developed such a program based on the "windowing shell" (wsh) from Tcl/Tk and the original Lua shell.

As a result of this effort, a separately loadable library (TkLuaLib.dll) and an executable (TkLua.exe) were built - the latter may be invoked both from a command line shell and from within Windows.

LuaSocket

The LuaSocket extension provides a number of functions for communication across data networks. Like before, "porting" the package is achieved by creation of a "def" file for the LuaSocket library and the integration of this library into the executables of Lua and TkLua.

The result of this effort are a separately loadable library (LuaSocketLib.dll) and new versions of the Lua and TkLua executables (LuaSocket.exe and TkLuaSocket.exe).

Distributions and Project Files

If you are only interested in the result of the author's porting activities, you may just download the binary files as a single ZIP archive - the following section contains a description of how to install them:

Otherwise, you may download the source files written/modified by the author and the corresponding project files for Microsoft Visual Studio 6.0 as well:

(Please note: none of these archive files contains any (unmodified) source code from the original distributions of Lua, tolua, TkLua or LuaSocket - you will have to download them separately).

Installation Guide

For the time being, there is no installation script - if need be, the author may try to provide such a script (assuming plenty of requests).

Thus, the installation must be performed manually as follows:

  1. Install Tcl/Tk 8.3.4 first
    before you may use TkLua you will have to install Tcl/Tk version 8.3.4. Download the distribution for Win32 platforms from [8] and install it on your system;

  2. Download the Lua Distribution
    now download the ZIP archive containing the author's distribution of Lua for Win32 platforms;
  3. Unpack the Lua Distribution (into a directory for program files)
    unpack the ZIP archive into a directory of your choice - the author recommends a folder foreseen for program files such as "c:\Program Files\Lua";

  4. "Install" the Lua DLL files
    copy or move any DLL files from the installation directory to the windows system folder (e.g., "c:\Windows") - this enables the system to locate the Lua libraries automatically;

  5. Append the Lua runtime to your Command Search Path
    in order to be able to invoke Lua and TkLua from a command line shell the Lua installation folder has to be included in the command search path. It may also be useful to define shortcuts to simplify the invocation of both shells. The author has added the following commands to his Autoexec.bat file ("c:\Programme" is the german equivalent for "c:\Program Files" used in other Windows installations - you may therefore have to adapt the following lines according to your needs):

      set LuaHome=c:\Programme\Lua
      set Path=%Path%;%LuaHome%
    
      c:\windows\command\doskey   Lua=%LuaHome%\Lua $*
      c:\windows\command\doskey TkLua=%LuaHome%\TkLua $*
    

    If you plan to use the LuaSocket extension, just add the following lines instead of those shown above:

      set LuaHome=c:\Programme\Lua
      set Path=%Path%;%LuaHome%
    
      c:\windows\command\doskey   Lua=%LuaHome%\LuaSocket $*
      c:\windows\command\doskey TkLua=%LuaHome%\TkLuaSocket $*
    
    
  6. Configure Tcl/Tk for TkLua
    additionally, it is necessary to configure Tcl/Tk (within Autoexec.bat) as follows:
      set TclHome=c:\Programme\Tcl
    
      set Tcl_Library=%TclHome%\lib\tcl8.3
      set  Tk_Library=%TclHome%\lib\tk8.3    
    

    The lines shown above rely on the assumption that Tcl/Tk has been installed into "c:\Programme\Tcl" - otherwise, you will have to modify the given directory name according to the situation on your system. Without these commands, TkLua is unable to initialize Tcl/Tk properly;

  7. Restart the System
    in order to activate the modifications applied to Autoexec.bat, you will now have to restart your system (sorry for that).

Upon successful completion of all these installation steps, Lua, TkLua, LuaSocket and tolua should have become available on your system (some Lua modules which belong to LuaSocket and provide support for upper layer protocols such as ftp, http and smtp plus some utility functions can be found in subfolder "Socket" within the Lua installation directory) You may use the author's Lua programming examples or programs from the "Acquainting" series to test your installation.

References

[1] Lua 4.0 - Source Code and Platform-specific Distributions
(see http://www.lua.org/download.html)
the given page refers to the original source code and a number of binary distributions for several platforms;
[2] Win32 Port of Lua 4.0
(see http://www.tecgraf.puc-rio.br/lua/ftp/binaries/Windows/)
the given ftp directory contains Lua libraries for several C development systems (Borland, Visual Studio, Watcom) and ready-to-use executables for execution and compilation of Lua scripts - for Win32 platforms;
[3] Philippe Lhoste
Lua Page

(see http://jove.prohosting.com/~philho/softwares/PhiLhoSoft/Lua/index.html)
another Lua distribution (including project files) for Win32 platforms is provided by Philippe Lhoste;
[4] Waldemar Celes
tolua - accessing C/C++ code from Lua
(see http://www.tecgraf.puc-rio.br/~celes/tolua/)
tolua simplifies the construction of Lua interfaces for existing f C/C++ code. The given web page explains the underlying mechanism of tolua and describes how to use that tool;
[5] Waldemar Celes
tklua - Binding Tk to Lua
(see http://www.tecgraf.puc-rio.br/~celes/tklua/)
TkLua provides support for Tk widgets (allowing to construct graphical user interfaces) from within Lua scripts. The given web page describes the "basic concepts" behind TkLua and explains how to use it from within Lua scripts;
[6] Christian Vogler
TkLua (4.0a1)
(see http://www.cis.upenn.edu/~cvogler/lua/tklua.html)
since the original distribution of TkLua [5] has been developed for Lua versions prior to 4.0, Christian Vogler ported TkLua to the new Lua 4.0 API;
[7] Diego Nehab
LuaSocket - IPv4 Sockets support for the Lua language
(see http://www.tecgraf.puc-rio.br/~diego/luasocket)
LuaSocket provides support for a number of important IPv4 functions. From the given web page you will be referred to a description of LuaSocket as well as to source code and binary distributions;
[8] Tcl Developer Site
(see http://www.scriptics.com)
you will have to install Tcl/Tk in order to use TkLua. The given web page is a good starting point for any further investigation of Tcl/Tk;
[9] Download Tcl/Tk 8.3.4
(see http://www.scriptics.com/software/tcltk/downloadnow83.tml)
you may download Tcl/Tk 8.3.4 from the given page - this version is needed for TkLua;
[10] Lua 4.0 Update
(see ftp://ftp.tecgraf.puc-rio.br/pub/lua/lua-4.0-update.tar.gz)
the given address points to a file containing some bugfixes for Lua 4.0;

Disclaimer

Please, consider also the author's Disclaimer!

http://www.Andreas-Rozek.de/Lua/Distributions/index_en.html    (last Modification: 11.06.2002)