Building Lua, static linking using OW IDE

From Open Watcom

Jump to: navigation, search

This is almost identical to building with dynnamic linking.

Obtain the current source distribution and unpack into an empty subdirectory.

Fire up the OW IDE.

Create a new target named lua and of type command line executable

The file list is given in the file INSTALL but here is it anyway, insert these files into the target. Plus the source with main()

 lapi.c lcode.c ldebug.c ldo.c ldump.c lfunc.c lgc.c llex.c
 lmem.c lobject.c lopcodes.c lparser.c lstate.c lstring.c
 ltable.c ltm.c lundump.c lvm.c lzio.c
 lauxlib.c lbaselib.c ldblib.c liolib.c lmathlib.c loslib.c
 ltablib.c lstrlib.c loadlib.c linit.c
 lua.c

In / menu / options / C compile switches

Macro definitions

 WIN32

I'd set space optimisation and no debug. (the code is fine)

/menu/options/windows linking switches

Stack op, something much larger than OW default, with is very small maybe

 64k

Save the project.

Hit compile and all being well lua.exe has appeared.

Run it, should pick up the the dll and off you go. A good first test, assuming you can find the source files

 > dofile("factorial.lua")

This loads and executes a script with that name.

If you want you can add another target luac.exe, with is a compiler to binary for scripts. A compiled script is roughly the same size but load slightly faster and a known free from syntax errors. For most users this utility is of little use.

Personal tools