The linker syntax controls how the linkers work. Linker command-line options are case-sensitive.
The linkers can also use a configuration file called ILINK32.CFG(below) for options that you'd normally type at the command-line.
Syntax:
ILINK32 [@respfile][options] startup myobjs, [exe], [mapfile], [libraries], [deffile], [resfile]
[@respfile] A response(below) file is an ASCII file that lists linker options and file names that you would normally type at the command line. By placing options and files names in a response file, you can save the amount of keystrokes you need to type to link your application.
[options] Linker options that control how the linker works. For example, options specify whether to produce an .EXE or a DLL file. Linker options must be preceded by either a slash (/) or a hyphen (-).
startup A Borland initialization module for executables or DLLs that arranges the order of the various segments of the program. Failure to link in the correct initialization module usually results in a long list of error messages telling you that certain identifiers are unresolved, or that no stack has been created.
myobjs The .OBJ files you want linked. Specify the path if the files aren't in the current directory. (The linker appends an .OBJ extensions if no extension is present.)
[exe] The name you want given to the executable file ( .EXE, or .DLL). If you don't specify an executable file name, ILINK32 derives the name of the executable by appending .EXE or .DLL to the first object file name listed. (The linker assumes or appends an .EXE extensions for executable files if no extension is present. It also assumes or appends a .DLL extension for dynamic link libraries if no extension is present.)
[mapfile] Is the name you want given to the map file. If you don't specify a name, the map file name is given the same as exefile (but with the .MAP extension). (The linker appends a .MAP extensions if no extension is present.)
[libraries] The library files you want included at link time. Do not use commas to separate the libraries listed. If a file is not in the current directory or the search path (see the /L option) then you must include the path in the link statement. (The linker appends a .LIB extension if no extension is present.)
The order in which you list the libraries is very important; be sure to use the order defined in this list:
Code Guard libraries (if needed)
List any of your own user libraries, noting that if a function is defined more than once, the linker uses the first definition encountered
IMPORT32.LIB (if you’re creating an executable that uses the Windows API)
Math libraries
Runtime libraries
[deffile] The module definition file for a Windows executable. If you don't specify a module definition (.DEF) file and you have used the /Twe or /Twd option, the linker creates an application based on default settings. (The linker appends a .DEF extension if no extension is present.)
[resfile] A list of .RES files (compiled resource files) to bind to the executable. (The linker appends an .RES extension if no extension is present.)
=================================================
You can use response files with the command-line linkers to specify linker options.
Response files are ASCII files that list linker options and file names that you would normally type at the command line. Response files allow you longer command lines than most operating systems support, plus you don't have to continually type the same information. Response files can include the same information as configuration files, but they also support the inclusion of file names.
Unlike the command line, a response file can be several lines long. To specify an added line, end a line with a plus character (+) and continue the command on the next line. Note that if a line ends with an option that uses the plus to turn it on (such as /v+), the + is not treated as a line continuation character (to continue the line, use /v+ +).
If you separate command-line components (such as .OBJ files from .LIB files) by lines in a response file, you must leave out the comma used to separate them on the command line. For example,
/c c0ws+
myprog,myexe +
mymap +
mylib cws
leaves out the commas you'd have to type if you put the information on the command line:
ILINK32 /c c0ws myprog,myexe,mymap,mylib cws
To use response files,
1. Type the command-line options and file names into an ASCII text file and save the file. Response files shipped with C++Builder have an .RSP extension.
2. Type ILINK32 @[path]RESFILE.RSP where RESFILE.RSP is the name of your response file.
You can specify more than one response file as follows:
ilink32 /c @listobjs.rsp,myexe,mymap,@listlibs.rsp
Note: You can add comments to response files using semicolons; the linker ignores any text on a line that follows a semicolon.
================================================== =====
ILINK32 uses a configuration file called ILINK32.CFG for options that you would normally type at the command line (note that configuration files can contain only options, not file names). Configuration files let you save options you use frequently, so you do not have to continually retype them.
ILINK32 looks for ILINK32.CFG in the current directory, then in the directory from which it was loaded.
The following ILINK32.CFG file tells ILINK32 to look for libraries first in the ..\LIB directory of your Borland compiler, then in C:\WINAPPS\LIB, to include debug information in the executables it creates, to create a detailed segment map, and to produce a Windows executable (.EXE not .DLL).
;Sample ILINK32.CFG file
/Lc:\BORLANDC\LIB;c:\WINAPPS\LIB
/v /s
/Tpe
Note: If you specify command-line options in addition to those recorded in a configuration file, the command-line options override any conflicting configuration options.