This mode takes commands in a similar form to a command prompt. The commands are order dependent with the exception that the map command may be given at any point.
A list of the interactive mode commands is given below. Note that the alias is given in brackets alongside the command and that all commands are case insensitive.
You can type the commands or, more likely, have them pre-entered in a text file. You simply add the name of the command text file to the main slink command line:
slink your-command-file
addobj [filename | @listfile]
The specified COFF object is to be included in a COFF archive. Only COFF object
and COFF archive files may be so loaded. PE executables and dynamic link
libraries (DLLs) may not. This allows COFF archives to contain ReLocatable
Binary (RLB) code and also be an IMPort LIBrary (IMPLIB) for a DLL.
SALFLIBC.LIB is such an example, it is an import library for SALFLIBC.DLL and
yet contains RLB for the startup procedure SALFStartup.
Alternatively, a list of COFF objects to be included may be inserted in a listfile the path of which is preceded by an @.
archive (implib) filename
Specifies that an archive is to be generated from objects loaded with the addobj
command. It also specifies that an import library is to be generated from the
export list, if it is non-empty.
comment [on | off | "text"]
text
is inserted into the .comment section in the executable. The text must
be delimitted by a quotation mark ("). Alternatively you can use on
or off to enable the inclusion of .comment sections from COFF
objects from that point onwards in the link process.
decorate
Symbols in the map and in the listing of unresolved externals are normally
reported in their undecorated form. This command will force symbols to be
reported in their decorated form.
dll (library) modulename
Specifies that a DLL library is to be generated. DLLs have an internal name,
distinct from the filename, used by the system loader to recognise the DLL. The
DLL command also sets the internal name (i.e. the module name) that the DLL is
known as to the system loader to
modulename.
If a module name is not specified, then the module name is generated from the file name with a .DLL suffix. Note that this is equivalent to the library keyword in a module definition file (.DEF file). The default suffix for the file command is set to .DLL.
For example, one of the system DLLs, USER.DLL, has a filename USER32.DLL. By default, SLINK will set the internal name of the DLL to be the same as the filename.
entry symbol
Specifies the entry point for the program. For linking Silverfrost compilations,
this command is unnecessary as the entry SALFStartup is assumed. If used, this
command MUST be the first command in the SLINK session. If this command is not
used, then the entry point will be set to SALFStartup after the first object
file has been loaded. If an entry point other than SALFStartup has been
specified, this will disable the default loading of SALFLIBC.LIB.
export entryname[=internalname] [@ordinal [noname]] [constant]
This has the same syntax as an entry in the exports section in a .DEF
file. It adds an entry to the export list. The entryname specified does not
have to exist but if it does not it may cause a run time error if the entry
point is used. If the DLL command is not used the module name is generated from
the file name with a .EXE suffix. Overrides the exportx command.
Note: Only a shortened version of this command is available in command line mode.
ordinals
An exported function's ordinal is a two byte integer. The system loader will ultimately obtain the function's address from the ordinal table and the export address table. It does this by looking up the function's ordinal from its name and then using the ordinal as an index into the export address table. By default SLINK will assign ordinals to the exported functions. However, you may wish to guarantee that the function has the same ordinal in all builds of the DLL. In which case you may specify the ordinal with this command
e.g. the following example will assign ordinal 4 to the function func exported as gloop
export gloop=func @4
noname
This will export the function by ordinal only. This is used to hide a function within a DLL but still make it accessible to those who know its ordinal. You must specify the ordinal if you use the noname keyword.
e.g.
export func @4 NONAME
will export func by ordinal only, with an ordinal value of 4 whilst
export func NONAME
will produce an error.
exportall
Adds all exportable code entries to the export list. These are code symbols
with storage class "external" that have been defined in a COFF object file,
i.e. not a COFF archive or DLL. This excludes you from re-exporting an entry
point in another DLL unless you specifically export it with the EXPORT
statement.
exportx
This prevents symbols from being included in the export list generated by the
exportall command. The
export command will take precedence over
this command if a symbol appears in both.
file (fi) filename
Performs the following actions in order.
Symbols specified in the export list are exported and the export (.edata) section generated. The archive, if required is also generated.
Scans the default libraries
FTN77.DLL or FTN95.DLL
SALFLIBC.LIB (unless an entry command has been used specifying other than _SALFStartup see above). SALFLIBC.LIB will be searched for in the following places:
Locally
The directory specified in the environment variable SCCLIB.
The directory above that specified in the environment variable SCCINCLUDE.
The directory where the invoked copy of SLINK resides.
The scanning of each of the following DLLs is dependent upon there being unresolved references and upon the DLL in question being present. These are searched for in the following places:
Locally
The "system directory", i.e. the directory returned by the function GetSystemDirectory e.g. C:\WINNT\SYSTEM32.
The directories specified on the system path
The directory where the invoked copy of SLINK resides.
KERNEL32.DLL
USER32.DLL
GDI32.DLL
COMDLG.DLL
Generates the internal traceback map
Generates the map listing file if one has been requested.
Displays a list of unresolved external references.
Writes the executable. If an executable is to be written, a suffix of .EXE is appended to filename as a default if one has not been supplied. If a DLL is to be written, a suffix of .DLL is appended to filename as a default if one has not been supplied.
Exits SLINK.
Note: Missing externals will not cause a failure but will generate warnings. However, if an attempt is made to call one of the missing routines at run time a message will be printed out giving the name and the return address of the routine. The user's program is then aborted.
filealign value
Specifies the physical alignment of the sections within the file. value should
be an integral power of 2.
default value = 0x200
heap reserve[,commit]
Specifies the program heap size in bytes. An initial heap of
commit
bytes will be allocated. If this is used up then a further
commit
bytes will be allocated up to the maximum size of
reserve. The
reserve
and
commit
values are rounded to 4 byte boundaries.
Silverfrost libraries provide their own heap and so a minimal heap need only be specified.
defaults:
for Silverfrost programs:
reserve = 0x0
commit = 0x0
for other programs:
reserve = 0x100000 (1Mb)
commit = 0x1000 (4Kb)
imagealign (align) value
Specifies the virtual address alignment in bytes of sections within the
executable.
value
should be an integral power of 2.
default value = 0x1000
imagebase (base) address
Specifies the preferred base address for the loaded image. This may be
relocated by the loader.
The virtual address space begins at 0x00000000 but the user program starts much higher in memory. The base command specifies the virtual address at which the program is to start. This is called the preferred load address. If the system loader cannot load the program at that address it calculates what is called a DELTA which is the difference between the preferred load address and the actual load address. This DELTA is then applied to all the virtual addresses in the program, actually those specified in the program's fix up table. SLINK will set the base address to be 0x00400000 for executables and 0x01000000 for DLLs. You may wish to change the base address if there is already something else loaded at that address. The fix up process is much more likely to affect DLLs than executables. However, the fix up process is so fast that it is tiny in comparison with the load process overall and can safely be ignored. The base address is specified in decimal, but can also be specified in hex or octal using the 0x or 0 prefixes respectively.
The value set by the base command will be rounded down to be a multiple of 64K. The resulting value must be non zero.
defaults:
executables
address = 0x00400000
DLLs
address = 0x01000000
The following example sets the base address to be 0x00700000
BASE 0x700000
insert filename
Executes the linker commands contained in the text file filename.
listunresolved (lure)
Prints a list of external references which are missing. This command may be
used to check the progress of a SLINK session and may be used at any time. This
command has no other effect.
load (lo) filename
Loads object file filename.
filename
may be either a COFF object file, a COFF archive library (i.e. .LIB) or a
directly imported dynamic link library (.DLL). A .OBJ suffix will be appended
to
filename
if one isn't already supplied.
SALFLIBC.LIB will automatically be loaded if has not already been loaded and if the entry point name has not been changed from SALFStartup.
map filename
Specifies that a symbol map file should be produced and written to filename.
The action of this command will be deferred until all object files have been
loaded. A suffix of .MAP is appended as a default if one has not been supplied.
notrace
Suppresses the generation of the internal map within the executable. Without
this map a runtime traceback is impossible.
rlo dllname
Loads the DLL dllname. rlo has the same effect as lo (load) but when the resulting application is
executed, the DLL is not required to be accessible when the application is loaded. The binding is delayed until
the first call to a routine in the DLL. In other words, the executable can be run without the DLL being present
and a runtime failure will not occur unless and until a call is made to a routine in the DLL.
stack reserve [,commit]
Specifies the program stack size in bytes. An initial stack of
commit
bytes will be allocated. If this is used up then a further
commit
bytes will be allocated up to the maximum size of
reserve. The
reserve
and
commit
values are rounded to 4 byte boundaries.
defaults,
for Silverfrost programs:
reserve = 0x3200000 (50MBytes)
commit = 0x4000 (16KBytes)
for other programs:
reserve = 0x100000 (1MByte)
commit = 0x1000 (4KBytes)
virtualcommon (vc) [base, [commit]]
Specifies that the uninitialised data section, i.e. the .bss section is removed
entirely from the executable and placed into virtual paged memory. The
base
address of this virtual memory may be specified but should be done with care.
Similarly, a
commitvalue
can be specified to indicate how much memory should be committed from the
system at each acquisition. Small values of
commit
mean that there is less memory wastage whilst larger values will improve
(slightly) run time performance at the expense of memory usage.
base and commit must be aligned on a page boundary, i.e. if specifying the values in hex the least significant 3 digits must be zero.
defaults,
base = 0x20000000
commit = determined at run time initialisation
subsystem subsys
You should specify whether the program will require a Character User Interface
(CUI) or a Graphical User Interface (GUI). The subsystem specified should be
one of console for a CUI, windows for a GUI or native if
no subsystem is required. Win32 will not allow output to stdout unless console
has been selected as the subsystem.
By default, SLINK will set the subsystem to be console.
subsys should be one of the following:
native no subsystem required
windows a graphical user interface subsystem is required.
console application requires only a
character mode subsytem (but
using a GUI is not precluded).
default: subsys = console
The following example sets a CUI subsystem requirement.
SUBSYSTEM CONSOLE
quit (q)
Immediately exits SLINK. No output files are produced.