Linker

When a source file (.pro) is compiled the resulting object code is a .plm file. Several .plm files may be combined into one .xpl file using the Amzi! linker. The .xpl file contains all the code contained in the .plm files, plus the Amzi! Prolog library, alib.plm. See below for implications of this.

Prolog executable (.xpl) files are executed directly by the Amzi! runtime, either from the operating system command line, the Windows-IDE or from a C/C++, Java, Delphi, Visual Basic or other program. They, unlike .plm files, cannot be executed under the listener.

Running from the IDE

Normally the linker is invoked when you build a project by either choosing Project | Build Project or Project | Rebuild Project. Build will compile and link only the modified files in the project, whereas Rebuild compiles and links all the files.

The linker will includes all .pro files in the Prolog Project Properties. It will exclude any .pro files that are specified to be excluded in the project properties. Also any libraries checked in the project properties are included.

If your Project Properties refers to other projects (under Project References) then all the plm files from the referenced projects will be linked into your xpl file.

If there are any linker errors, they will be displayed in a window for you to peruse when the link is completed.

Running from the Command-Line

The Prolog linker is named alnk. It may be invoked in one of three ways. The easiest is to simply type alnk and respond to the prompts. For example, to create a load module called ducks.xpl for stand-alone execution from the object modules duck1.plm and duck2.plm:

The arguments to alnk can also be listed on the command line.

The first argument is the name of the Prolog load module (.xpl) file to be created. The other arguments are the various Prolog object module (.plm) files.

Note that this means if you are linking a single file, you need to specify the name twice, once for the .xpl file and once for the .plm file. For example:

If you have a large number of files to link, you can create an input script file for the linker and pipe it in on the command line.

where ducks.inp contains

You can also create a file for linker input and specify the file name after a -f option. For example, using the same ducks.inp above:

Libraries

If you are using any of the predicates in list.plm, misc.plm or any of the other libraries, you will need to add that file to your project and/or link it in as well.

Copyright ©1987-2011 Amzi! inc. All Rights Reserved. Amzi! is a registered trademark and Logic Server is a trademark of Amzi! inc.