ld Manual

Introduction to ld
ld Manual529650.001
1-10
C++ Programs
C++ Programs
There are three versions of C++:
When you compile a C++ program, you can specify its version with the command-line
directive VERSION1, VERSION2, or VERSION3. The default is VERSION3.
The version, known as the C++ Dialect, is stored in one of the program's internal
structures. To see a program’s C++ dialect, use the noft option LISTATTRIBUTE or
LA (see the noft Manual).
Mixing versions of C++ in a loadfile is not recommended (except for mixing
CPP_NEUTRAL with one other version). The result is either a nonfatal error or a
warning, depending on the combination:
For information about nonfatal errors and warnings, see Nonfatal Errors and Warnings.
C++ programs require access to their run-time environments. To create an executable
C++ program, you must link to the run-time environment initialization code and the
DLLs your program uses. The NMC and c89 compilers automatically link to the
required items. If you use ld directly to link a C++ program, you must specify these
items in ld options. For details, see the C/C++ Programmer’s Guide.
Version
Conforms to ANSI and
ISO Standards for C++ Supports PIC
1No No
2No Yes
3 (default) Yes Yes
C++ Input Files C++ Version Recorded in the Loadfile*
VERSION1 CPP_V1 (1)
VERSION2 CPP_V2 (2)
VERSION3 CPP_V3 (3)
Mixed versions Lowest version
*
When none of the input files are C++ files, the value CPP_NEUTRAL is recorded in the loadfile.
LINKFILE
CPP_NEUTRAL CPP_V1 CPP_V2 CPP_V3
L
I
N
K
F
I
L
E
CPP_NEUTRAL Loadfile is
CPP_NEUTRAL
Nonfatal
error
Loadfile is
CPP_V2
Loadfile is
CPP_V3
CPP_V1 Nonfatal error Nonfatal
error
Nonfatal
error
Nonfatal
error
CPP_V2 Loadfile is
CPP_V2
Nonfatal
error
Loadfile is
CPP_V2
Nonfatal
error
CPP_V3 Loadfile is
CPP_V3
Nonfatal
error
Nonfatal
error
Loadfile is
CPP_V3