ld

interface to system linker 

Command


SYNOPSIS

ld [-e epsym] [-l library] [-L directory] [-m] [-M] [-o output_file] [-r] [-s] [-t] [-u symbol] [-VS number] [-W option] [-x] files...


DESCRIPTION

The ld command serves as an interface to the system linker (link).

Note:

The behavior of cc depends upon whether or not you are working in the standard MKS Toolkit development environment or the development environment designed for use with the MKS Toolkit UNIX APIs.

The ld command is invoked by the cc command in either development environment. It is also invoked by the cxx, ncf77, and ncf90 commands in the PTC MKS Toolkit UNIX APIs development environment. ld creates executables or shared libraries from object files and static libraries. While it is possible to directly use ld, in most circumstances, it is preferable to simply use the appropriate compiler command and let that command invoke the linker.

You can use the -W/option flag to pass options directly to link. link options specified with -W override link options generated by other ld options.

The Microsoft linker does not support the concept of combining multiple object files into one larger object file (which is done with ld -r on most UNIX systems).

Options

-e epsym  

specifies the entry point.

This option becomes the /ENTRY: epsym option to link.

-L directory  

adds the directory to the beginning of the list of directories that the linker searches for libraries (the value of the %Lib% environment variable). Any directories supplied on the command line are searched first, in the order in which they appear on the command line.

This option becomes the /Ldirectory option to link.

-l library  

adds the specified library to the list of libraries to be linked with. In searching for libraries (for example, with -lfoo), each library directory is first searched for the UNIX-style archive name (that is, libfoo.a) and then for the Windows-style library name (that is, foo.lib) in each library directory.

-M  

complains about multiply defined symbols.

-m  

produces a link map.

-o output  

specifies the name of the output file.

Because a -W/Fe option takes precedence over -o, you should normally only specify one of the two. For example:

ld -o my.exe -W/Fe<mynew.exe>

generates an output file named mynew.exe. A preferred way to use both options is to specify an output directory using -W/Fe and specify the output file name using -o. That is,

ld -o my.exe -W/FeC:\mysrcdir\obj\

Note:

A terminating backslash(\) is needed for ld (or link) to recognise a directory specification.

-s  

strips debugging information from the output file.

This option becomes the /DEBUG: none option to link.

-t  

turns off warnings about multiply defined symbols.

This option becomes the /FORCE:MULTIPLE option to link.

-u symname  

adds an undefined reference to symname.

This option becomes the /INCLUDE:symname option to link.

-VS num  

Assigns a version number.

This option becomes the /VERSION:num option to link.

-W/option  

Specifies an option that is to be passed to the link with the leading -W removed.

-W/subsystem:subsystem-name  

specifies the name of the subsystem.

This option becomes the /SUBSYSTEM:subsystem-name option to link.

-W/dll 

specifies that the object is being linked as a DLL.

-W/entry:entry 

specifies the entry point.

This option becomes the /ENTRY:entry option to link.

-W/out:output 

specifies the name of the linker output similar to the -W/Fe or -o options.

This option becomes the /OUT:output option to link.

-Wabsf77  

links against the Absoft Fortran 77 runtime libraries.

Note:

This option is only available in the PTC MKS Toolkit UNIX APIs development environment.

-Wabsf90  

links against the Absoft Fortran 90 runtime libraries.

Note:

This option is only available in the PTC MKS Toolkit UNIX APIs development environment.

-Wc++ 

links against the C++ runtime libraries.

Note:

The C++ library paths are only available when working in the development environment for the PTC MKS Toolkit UNIX APIs. If you are not working in this environment, you must specify these library paths with the -L option.

-Wv  

selects verbose mode.

-W/MD  

when used together with -Wc++, links against the DLL versions of C++ runtime libraries.

This option is not translated to a link option.

-x 

strips debugging information related to local symbols from the output file.

This option becomes the /DEBUG:partial option to link.


ENVIRONMENT VARIABLES

CCG 

identifies the configuration file for the desired linker. If CCG contains -, the the default configuration is read from the standard input. If CCG contains a file name, ld uses that file as its default configuration file. If CCG contains a directory name, ld looks for the default configuration in the ld.ccg file in that directory.


DIAGNOSTICS

Possible exit status values are:

0 

Successful completion.

>0 

An error occurred.


NOTE

The ld utility, like many of the other compiler-related commands such as cc, actually launches an appropriate CCG script (see the cc miscellaneous reference page) to preprocess the options described before calling Microsoft Link to perform the actual linking. The actual CCG script run is determined by the setting of the CCG environment variable (see ENVIRONMENT VARIABLES) which can vary depending on whether or not you're working in the NuTCRACKER Platform development environment.

To modify ld (for example, to work with a different linker), you simply need to modify the CCG script that ld runs based on the setting of the CCG environment variable.


AVAILABILITY

PTC MKS Toolkit for Developers
PTC MKS Toolkit for Interoperability
PTC MKS Toolkit for Professional Developers
PTC MKS Toolkit for Professional Developers 64-Bit Edition
PTC MKS Toolkit for Enterprise Developers
PTC MKS Toolkit for Enterprise Developers 64-Bit Edition
PTC Windchill Requirements and Validation


SEE ALSO

Commands:
cc, make, ncf77, ncf90

Miscellaneous:
cc


PTC MKS Toolkit 10.4 Documentation Build 39.