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 (which must be located in your PATH or AMZI_DIR environment variable).
Prolog executable (.xpl) files are executed directly the Amzi! runtime, either from the operating system command line, the Windows-IDE or from a C/C++, Visual Basic or other program. They cannot be executed under the listener.
Normally the linker is invoked when you build a project by either pressing the BLD button or selecting Build / Build from the menu. This will compile and link all the modified files in the project. (See the Projects section for more details.)
To link a single file (or project), press the LNK button or select Build / Link. You are presented with the standard "file open" dialog box to select the project (.ppj) or object file (.plm) to be linked. Usually you will use a project file, as most applications consists of more than one object file.
When you use a project, all the files in the project will be linked together (regardless of their extension, .pro or .plm).
The linker messages will be displayed in a window for you to peruse when the link is completed.
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:
c> alnk Amzi! Prolog Linker Copyright (c) 1987-2000 Amzi! inc. All Rights Reserved. Linked Module [.xpl]: ducks Compiled Code Module [.PLM]: duck1 Compiled Code Module [.PLM]: duck2 Compiled Code Module [.PLM]: % [Enter] key pressed Reading Atom Table: duck1.PLM Reading Atom Table: duck2.PLM Reading Code Segments: duck1.PLM Reading Code Segments: duck2.PLM 266 Global Atoms, 55 Local Atoms
The arguments to alnk can also be listed on the command line.
c> alnk ducks duck1 duck2
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.
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.
c> alnk < ducks.inp
where ducks.inp contains
ducks duck1 duck2
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-2000 Amzi! inc. All Rights Reserved.