2.7.2 Set the link order of files

The link order of object module files and library files is decided automatically, but you can also set the order.

The procedures for performing this operation are described below.

(1)

Open the Link Order dialog box

On the project tree, select the Build tool node, and then select [Set Link Order...] from the context menu. The Link Order dialog box will open.

Figure 2.65

Link Order Dialog Box

 

The names of the following files are listed in [File] in the order that the files are input to the linker.

-

Object module files which are generated from the source files added to the selected main project or subproject

-

Object module files which are added directly to the project tree of the selected main project or subproject

-

Library files which are added directly to the project tree of the selected main project or subproject

Remark

The default order is the order that the files are added to the project.
Object module files generated from newly added source files and newly added object module files are added after the last object module file in the list.
Newly added library files are added to the end of the list.

(2)

Change the file display order

By changing the display order of the files, you can set the input order of the files to the linker.

Change the file display order by one of the following procedures.

-

Move the file name by using the [Up] and [Down] buttons.

-

Drag and drop the file name.

-

Use a link order specification file.

Remark

You can use a link order specification file to change the display order on a file basis.
The procedures for performing this operation are described below.

(a)

Generate a link order specification file

Click the [Export] button in the Link Order dialog box to open the Select Export File dialog box.

Figure 2.66

Select Export File Dialog Box

 

In the dialog box, specify the file (link order specification file) that is output the list of the file names displayed in [File] in the Link Order dialog box.

Click the [Save] button to generate the link order specification file.

Caution

Only the file names are output to the link order specification file.
If a file with the same name exists, check the location of the file in the popup display after installing the link order specification file.

(b)

Edit the link order specification file

Open the link order specification file with an editor, and then change the description order of the file names.

The code example of the link order specification file is shown below.

# CS+ Vx.xx.xx Link order specification file
# SampleProject: Xxxxxx xx, xxxx
 
file01.obj
file03.obj
library02.lib
file02.obj
library01.lib
library03.lib
    :

The following points should be noted when describing the link order specification file.

-

Describe one file name on one line.

-

Uppercase characters and lowercase characters are not distinguished for the file name.

-

If the line begins with "#", the line is interpreted as a comment.

-

A space or tab is ignored.

(c)

Import the link order specification file

Click the [Import] button in the Link Order dialog box to open the Select Import File dialog box.

Figure 2.67

Select Import File Dialog Box

 

In the dialog box, select the link order specification file and click the [Open] button.

The description order of the file names are acquired from the selected link order specification file, and then they are reflected in [File] in the Link Order dialog box.

Figure 2.68

Link Order Dialog Box (After Setting Link Order)

Caution 1.

The file that is described in the link order specification file and is not added to the project is not displayed.
If the corresponding file exists, the list of the file names will be displayed in the Output panel.

Caution 2.

The file that is added to the project and is not described in the link order specification file is displayed in the end of [File].

Caution 3.

If a file with the same name exists, check the location of the file in the popup display (it will appear when you hover the mouse cursor over the file name).
To change the link order, use the [Up] and [Down] buttons, or drag and drop the file names.

(3)

Set the file link order

Click the [OK] button in the Link Order dialog box to set the input order of the files to the linker.