Lard Toolkit User Guide

Overview of most common usage


The various programs that make up the LARD toolkit have many complex options, but for most applications most of them can be ignored. This overview explains a subset of the commands that can be used to compile and execute most programs.

Source programs, which are given the extension .l, are compiled, assembled and linked into a binary program. This binary, which is given the extension .bcode, is executed using the interpreter li.


Prior to using the toolkit for the first time it may be necessary to set two environment variables:

You must also add the toolkit binary directory to your path.

The recommended way of setting these variables is with the following code (ksh/bash syntax):

	LARDHOME=/home/amulinks/lard/v10	# or wherever you have it
	export LCD_OPTS="-lio -lchannels -ltime"
Whether you should put the channels and time libraries in your LCD_OPTS variable depends on whether your programs always use them.

This arangement works with the default LARD installation arangements where binaries and libraries are put in architecture-specific directories.


The compiler driver program, lcd, greatly simplifies the compilation, optimisation, assembly and linking process. To compile a source program foo.l into a binary foo.bcode, simply use a command such as the following:

Making Libraries

When a project is split over several source files all but the "main program" should be treated as libraries. See the lcd documentation for details of how to compile a library.

Consider a project with four source files:

The following Makefile describes the dependencies between the files and rules for compiling them:

	all: toplevel.bcode

	defs.dcode defs.bcode: defs.l
		lcd -mklib defs.l

	block1.dcode block1.bcode: block1.l defs.dcode
		lcd -mklib -ldefs block1.l

	block2.dcode block2.bcode: block2.l defs.dcode
		lcd -mklib -ldefs block2.l

	toplevel.bcode: toplevel.l defs.dcode defs.bcode block1.dcode \
	block1.bcode block2.dcode block2.bcode
		lcd -ldefs -lblock1 -lblock2 toplevel.l
With this Makefile in place it is only necessary to type make and the minimum ammount of recompilation to produce an up-to-date executable is carried out.


bcode files are executed using the program li. li is based on the tcl command interpreter. If you start li as follows

	li foo.bcode
the bcode file is loaded and a prompt is displayed where you can type tcl commands. Alternatively you can give additional command line arguments that name "modules" to load. The two most usefull are

	li foo.bcode run
which loads the bcode file and runs it with input/output from the command line, and

	li foo.bcode windows
which starts the tk graphical front end.

Note that li foo.bcode looks for a file li foo.lirc containing tcl commands which it will execute at start up.