Jump to 
content
HP.com Home Products and Services Support and Drivers Solutions How to Buy
»  Contact HP

 

HP C++

HP C++
User's Guide for OpenVMS Systems


Previous Contents Index


Chapter 1
Building and Running C++ Programs

C++ is an evolving language in which new features have recently replaced outmoded constructs. The C++ Standard Library provided with this release defines a complete specification of the C++ International Standard, with some differences, as described in the C++ release notes.

When switching from a Version 5.n compiler, you might need to modify your source files, especially if you use the default language mode. In addition, language changes can affect the run-time behavior of your programs. If you want to compile existing source code with minimal source changes, compile using the /STANDARD=ARM qualifier. See Chapter 2.

This chapter provides information about basic steps in developing a C++ program on an OpenVMS system. These steps are shown in Figure 1-1.

Figure 1-1 Steps in Developing a C++ Program


To create and modify a C++ program, you must invoke a text editor. The OpenVMS system provides you with at least two text editors: VAX EDT (EDT) and the DEC Text Processing Utility (DECTPU). Another editor that you can use is the DEC Language-Sensitive Editor (LSE), which is sold separately (see Appendix B for more information on LSE). Use .cxx as the file type to signify that you are creating a C++ source program.

When you compile your program with the cxx command, you do not have to specify the file type; by default, C++ first looks for files with the .cxx type.

If the compilation succeeds, the compiler creates an object file with the type .obj. If the compiler detects errors, the system displays each error detected. You then reinvoke a text editor to make corrections.

When your program compiles successfully, you use the CXXLINK facility to create an executable image. Compiler and linker commands both take qualifiers, as described in Sections 1.2 and 1.3.

When you have an executable image file, use the run command, or define a foreign command, to run your program. See Section 1.5 for more information on running image files.

1.1 Using the DECTPU Text Editor

With DECTPU, you have a choice of two editing interfaces, the Extensible Versatile Editor (EVE) or the DECTPU EDT Keypad Emulator. You can also create your own interfaces with DECTPU. At any time during your editing session you have access to online help.

When you invoke DECTPU to create a file, the editor automatically creates a journal file, which you can use to recover your keyboard entries if the system fails during an editing session. To initiate recovery, use the following command format:

edit/tpu/recover file-spec

The interactive editor interface, EVE, responds to all the common editing functions, invoked using the editing keypad, and supports more advanced functions that you type as commands on the EVE command line. For more information on using EVE, see the Guide to VMS Text Processing.

1.2 Using the Compiler

The compiler detects source program errors and shows each error either in a screen display or in the batch log file, depending on whether you run the compiler interactively or in batch mode. If the compilation succeeds, the compiler generates machine-language instructions from the source statements, and groups these instructions into an object module for the linker.

The compiler command cxx has the following format:

cxx[/qualifier...][ file-spec [/qualifier...]],...

You use qualifiers to instruct the compiler to perform some action. A qualifier placed immediately after the CXX command affects all the files listed. A qualifier placed immediately after a file specification affects only the preceding file, unless you concatenate your files. A qualifier placed on an individual file specification overrides a qualifier placed immediately after the CXX command.

If you include more than one file specification on the same line, use commas (,) or plus signs (+) as separators. For example:


$ cxx/list prog_1, prog_2, prog_3 

A comma instructs the compiler to keep source files separate and to create an object file and a listing file for each source file. A plus sign instructs the compiler to concatenate each of the specified source files, and to create one object file and one listing file. Any qualifier specified for one file within a list of concatenated files affects all these files.

Note

Comma lists are not supported on I64 systems. Their use causes a fatal error.

1.2.1 Compiler Command Qualifiers

For a complete description of command line qualifiers, refer to Appendix A

1.2.2 Compiler Error Messages

If the compiler detects errors in your source code, the compiler signals these errors by displaying diagnostic messages in the following format:

%CXX-s-ident, message-text
at line number n in file name

s

Is the error severity, represented as follows:
F Fatal error. The compiler stops immediately without producing an object file. You cannot link the program until you correct this error.
E Error. The compiler proceeds, and possibly generates other messages, but does not produce an object file. You cannot link the program until you correct this error.
W Warning. The compiler takes some corrective action and produces an object file. However, to avoid unexpected results you must verify that the compiler's action is what you wanted.
I Information. The compiler informs you of specific actions taken. You need not take any action yourself regarding this message.
S Success.

ident

Is a mnemonic (abbreviation) of the message text.

message-text

Is the full text of a compiler diagnostic message explaining what happened.

n

Is an integer that gives you the number of the line where the error occurs. The number is relative to the beginning of the file or module in which the error occurs. The number appears on your terminal but not in listing files.

name

Is the name of the file or module in which the error occurs. The name appears on your terminal but not in listing files.

To be sure your program runs successfully, examine the diagnostic messages, evaluate error severity, and make any necessary corrections.

You can suppress certain information and warning diagnostic messages using the #pragma message preprocessor directive. For information about this directive, see Section 2.1.1.11.

1.3 Linking a Program (ALPHA ONLY)

This section describes how to link a C++ program on OpenVMS Alpha systems.

After your program or module successfully compiles, you must use the CXXLINK facility to combine your object modules into one executable image.

The CXXLINK facility is layered on the OpenVMS Linker utility and provides the ability to link your C++ application. Besides linking your C++ application, the CXXLINK facility completes the automatic template instantiation process; see Chapter 5 for details. CXXLINK also ensures that the Standard Template Library run-time support and the exception handling run-time support are linked into your application as needed.

CXXLINK uses the same command line format that you would use to invoke the OpenVMS Linker utility; thus, you can simply replace the LINK verb with CXXLINK in your command procedures. The CXXLINK command has the following format:

CXXLINK[/command-qualifier]... {file-spec[/file-qualifier...]},...

If you include more than one input file specification, use commas or plus signs as separators. By default, the linker creates an output file with the same name as the first input file and the file type .exe. If you want the output file to take the name of your main program, be sure to specify your main program file first. You can also use the /EXECUTABLE=name .exe qualifier on the CXXLINK command line to specify a name for the executable image.

Do not use the linker cluster= option to reference OpenVMS object modules that define global static objects. Using this option prevents the constructors and destructors for global static objects from being run during image activation and exit.

Caution

The OpenVMS Linker expects a function whose identifier is main. If a C++ program lacking a definition of main is inadvertently linked, then program execution begins at the first function seen by the linker.

1.3.1 CXXLINK Interactions with OpenVMS Linker Qualifiers

CXXLINK makes use of the OpenVMS Linker Utility's LNK$LIBRARY logical names to specific object libraries as input to the linker. If the CXXLINK command includes the /USERLIBRARY qualifier in any form, an informational message will be displayed and CXXLINK will list any required object libraries in a linker options file.

1.3.1.1 Command Parameters and Qualifier

In addition to the following qualifiers, the CXXLINK command accepts the same parameters and qualifiers as the OpenVMS Linker utility (see Section 1.3.5 for some of the more useful OpenVMS Linker qualifiers). CXXLINK-specific qualifiers are stripped off prior to calling the OpenVMS Linker utility and therefore have no effect on default device or directory specifications applied by the OpenVMS Linker facility.

Command Qualifiers Defaults
/[NO]LOG_FILE[=filename] /NOLOG_FILE
/PREINST /PREINST
/PRELINK=(option[,option2]) See HELP.
/REPOSITORY=(writeable-repository
[,readonly-repository,...]) See HELP.
/USE_LINK_INPUT[=filename] /NOUSE_LINK_INPUT
/VERSION None.

For more information about CXXLINK qualifiers and parameters, type HELP CXXLINK.

1.3.2 Migrating from LINK to CXXLINK

Because a single CXXLINK command can invoke the OpenVMS Linker utility multiple times, you must not specify user mode (DEFINE/USER_MODE) logical names. If CXXLINK executes a second LINK command, the original DEFINE/USER_MODE logical name is not retained for that second command. Incorrect results can occur.

You should check command procedures that perform link operations of code generated by the C++ compiler for any /USER_MODE logical names that are intended to be in effect during a LINK operation. If you find any, you can modify the procedures CXXLINK in one of the following ways:

  • Define the logical name without /USER_MODE. This means that the logical name should be deassigned, or its previous value reassigned, after the CXXLINK operation is completed to ensure that prior state is restored. Any ON ERROR cases that may be jumped to if the CXXLINK fails should check for and deassign or reassign the logical name if needed.
  • Move the definition(s) into a separate command procedure. CXXLINK checks the logical name CXX$LINK_INIT, and if it is defined, executes the command procedure in its subprocess prior to executing any LINK command.
    Consider the following procedure:


    $ DEFINE/USER MYLIB MYAREA:MYLIB.OLB
    $ LINK A,B,SYS$INPUT:/OPT 
    MYLIB/LIB
    $ 
    

    To have the procedure work with CXXLINK, modify it as follows:


    $ CREATE CXX$LINK_INIT.COM
    $ DEFINE MYLIB MYAREA:MYLIB.OLB 
    $EOD
    $ DEFINE/USER CXX$LINK_INIT SYS$DISK:[]CXX$LINK_INIT.COM
    $ LINK A,B,SYS$INPUT:/OPT 
    MYLIB/LIB
    $! 
    $ DELETE CXX$LINK_INIT.COM;
    

Note that the CXX$LINK_INIT command procedure defines MYLIB without the /USER_MODE qualifier. This is because the command procedure is executed only once in the spawned process.

1.3.3 Linking to the C++ Standard Library

When you compile and link programs that use the C++ Standard Library, no special qualifiers are required. The C++ driver automatically includes the Standard Library run-time support on the link command, and automatic template instantiation is the default mode.

For example, to build a program called prog.cxx that uses the Standard Library, you enter the following command:


$ CXX prog.cxx 

For detailed information about the Standard Library, refer to Chapter 7.

1.3.4 Linking to the C++ Class Library

Reusing code is a cornerstone of object-oriented programming. To minimize the time it takes to develop new applications, a set of reusable classes is an essential part of the HP C++ compiler environment. Class libraries offer a variety of predefined classes that enable you to work more efficiently.

For a detailed explanation of the class library packages supplied with the compiler, see the HP C++ Class Library Reference Manual .

The Class Library has always been provided in shareable image format. Starting with OpenVMS Version 6.2, the Class Library is also provided in object library format.

Using the Class Library as an object library provides a functional advantage over using the shareable image. When your program redefines the global new and delete operators and uses the Class Library object library, the new and delete calls within the Class Library are directed to the new and delete operators defined by your program. On the other hand, when your program uses the Class Library shareable image, the new and delete calls within the Class Library always call the standard new and delete operators. Linking with the shareable image is the default method.

When you use the Class Library as a shareable image, the Class Library code resides in an image file in SYS$SHARE and is shared by all C++ programs. This process has the advantages of: reducing the size of a program's executable image, decreasing the amount of disk space taken up by the program's image, and letting your program swap in and out of memory faster because of decreased size.

1.3.4.1 Linking Against the Class Library Object Library

To link against the Class Library object library on OpenVMS Version 6.2 or higher systems, you need to specify the /NOSYSSHR qualifier on your CXXLINK command. For example:


$ CXXLINK/NOSYSSHR my_program.obj 

If your program defines nonlocal static objects whose constructors or destructors use any part of the Class Library, you need to ensure that the Class Library is initialized before your objects' constructors are invoked. (Note that this is not an issue when you link against the Class Library shareable image.) To guarantee this order of initialization, specify the Class Library initialization object module CXXL_INIT as the first module in your CXXLINK command. To do this, use a CXXLINK command similar to the following:


$ CXXLINK/NOSYSSHR/EXE=my_program SYS$SHARE:STARLET.OLB/INCLUDE=CXXL_INIT, - 
_$ my_program.obj 

If your program uses the task package, you must explicitly include the CMA shared library when you link /NOSYSSHR, as in the following example:


$ CXXLINK/NOSYSSHR my_program.obj,SYS$INPUT:/OPT - 
_$ SYS$SHARE:CMA$LIB_SHR/SHARE 
^Z 

1.3.4.2 Linking Against the Class Library Shareable Image

No special action is needed to link with the Class Library; simply specify the object modules and object libraries that you want to link. The linker automatically finds and resolves any references to objects in the Class Library when it searches the system-supplied shareable image library, SYS$LIBRARY:IMAGELIB.OLB.

1.3.5 Linker Command Qualifiers

You can use qualifiers to modify OpenVMS Linker output and to invoke debugging and traceback facilities. The following list shows some of the most useful LINK command qualifiers that you can specify on your CXXLINK command. For a full discussion of the OpenVMS Linker, see the OpenVMS Linker Utility Manual.
Command Qualifiers Defaults
/BRIEF None.
/[NO]CROSS_REFERENCE /NOCROSS_REFERENCE
/[NO]DEBUG /NODEBUG
/[NO]EXECUTABLE[=file-spec] /EXECUTABLE=first-object-file-name.exe
/FULL None.
/[NO]MAP /NOMAP (interactive) /MAP (batch)
/[NO]SHAREABLE /NOSHAREABLE
/[no]TRACEBACK /TRACEBACK

1.3.6 Linker Error Messages

If the OpenVMS Linker detects errors while linking object modules, the linker displays messages indicating the cause and severity of error. Because CXXLINK uses the OpenVMS Linker to link your C++ program, CXXLINK displays these linker messages. The linker does not produce an image file if errors or fatal errors occur (conditions with severities of E or F).

Some problems that commonly occur during linking are as follows:

  • You try to link a program without defining every function that the program calls.
    The linker responds by issuing warnings. For example:
    %LINK-W-USEUNDEF symbol-name
    A symbol name that you do not recognize could be a mangled name. Name mangling is the mechanism that the compiler uses to encode exceptionally long identifiers, including C++ function names. By default, CXXLINK displays such symbols in their demangled form. To see a symbol in its mangled form, use the /PRELINK=NODEMANGLE qualifier on your CXXLINK command. (See Section 1.6 for more information about name demangling.)
  • You try to link a module that had warning or error messages during compilation.
    To avoid unexpected results, verify that the linker's action is acceptable.
  • You try to link a nonexistent module.
    Check to see if the module exists (in the directory or library you expect it to be in) and is spelled correctly.
  • You redefine a C RTL function, or override the global operators new or delete . For more information, see the /[NO]PREFIX_LIBRARY_ENTRIES Qualifier in Section 1.2.1.

For an explanation of linker messages, invoke the HELP/MESSAGE utility.

1.4 Linking a Program (I64 ONLY)

This section describes how to link a C++ program on OpenVMS I64 systems.

After your program or module successfully compiles, you must use either the CXXLINK facility or OpenVMS Linker to combine your object modules into one executable image.

The CXXLINK facility is layered on the OpenVMS Linker utility and provides the ability to link your C++ application. On I64 systems, the CXXLINK facility accepts the same command qualifiers as CXXLINK on Alpha systems, including the full range of the Linker's command qualifiers that the CXXLINK facility passes to the Linker. For a description of Linker commands, see the OpenVMS Linker Utility Manual.

On I64 systems, the only benefit of using CXXLINK instead of the Linker is that CXXLINK reports non-mangled names of undefined and multiply-defined symbols. It does this by intercepting Linker diagnostics and converting mangled names reported by the Linker to their original names, using the information in the demangler database.

The demangler database is a file created by the compiler. By default, it is created in a [.CXX_REPOSITORY] subdirectory of the current directory. For both the C++ compiler and CXXLINK, the location of the repository is controlled by the /REPOSITORY qualifier. For CXXLINK to correctly translate mangled names to their original, non-mangled counterparts, it is important to use the same repository for both compiling and linking.

Do not use the Linker CLUSTER= option to reference OpenVMS object modules that define global static objects. Using this option prevents the constructors and destructors for global static objects from being run during image activation and exit.

Caution

The OpenVMS Linker expects a function whose identifier is main . If a C++ program lacking a definition of main is inadvertently linked, then program execution begins at the first function seen by the linker.

1.4.1 Linking Against C++ Class and Standard Library Shareable Images

On I64 systems, the C++ Class and Standard Library, as well as the language run-time support library, are delivered as system shareable images in SYS$LIBRARY:

CXXL$011_SHR.EXE - class library image
CXXL$RWRTL.EXE - standard library image
CXXL$LANGRTL.EXE - language run-time support image

As system shareable images, these CXXL$ images are part of the system library of shareable images, IMAGELIB.OLB, which is automatically searched by the Linker. Consequently, no special actions are required to link C++ applications against the class or standard library shareable image.

For example, if PROG.CXX uses a class from the C++ class or standard library, the following sequence of commands will compile, link, and run the program:


$ CXX PROG.CXX 
$ CXXL PROG.OBJ  ! (or LINK PROG.OBJ) 
$ RUN PROG.EXE 

1.4.2 Linking Against the Object Library (Linking /NOSYSSHARE)

In addition to being delivered as system shareable images, the C++ class, standard, and language run-time support libraries are also delivered in object form in the system object library STARLET.OLB, thus making it possible to link C++ applications /NOSYSSHARE.

The C++ libraries themselves do not impose any restrictions on linking /NOSYSSHARE. However, because they are layered on top of the C Run-Time Library, the rules for linking an application that references the C Run-Time Library /NOSYSSHARE do apply.

For example, when linking /NOSYSSHARE, you must explicitly include CMA$TIS routines in the link by either linking against the CMA$TIS_SHR.EXE shareable image or forcing the CMA$TIS module from STARLET.OLB in the link. See the HP C Run-Time Library Reference Manual for more details.

Here are two examples of linking a C++ program /NOSYSSHARE:


$ CXXL/NOSYSSHARE PROG.OBJ, SYS$INPUT:/OPT 
SYS$SHARE:CMA$TIS_SHR/SHARE 
^Z 
 
$ CXXL/NOSYSSHARE prog.obj, - 
_$ SYS$SHARE:STARLET.OLB/INCLUDE=CMA$TIS 

1.5 Running a C++ Program

When your program successfully links, use the DCL RUN command to execute the image file. The RUN command has the following format:

RUN [/[NO]DEBUG] file-spec

/DEBUG
/NODEBUG

Determines whether you invoke the OpenVMS Debugger during run time. Use the /DEBUG qualifier to invoke the debugger if your image was not linked with the debugger. However, do not use the /DEBUG qualifier on images linked with the /NOTRACEBACK qualifier. Use the /NODEBUG qualifier if you linked your image with the /DEBUG qualifier and you do not want the debugger to prompt you. The default is RUN/DEBUG if you linked your image with the /DEBUG qualifier; otherwise, the default is RUN/NODEBUG.

For more information on debugging C++ programs, see Chapter 8.

1.5.1 Run-Time Errors

When an error occurs during program execution, the OpenVMS condition handler terminates execution and displays messages and traceback information on the currently defined sys$error device. In the symbolic stack dump traceback message, the condition handler lists the modules that were active when the error occurred, indicating the sequence in which the modules were called.

Traceback information is available at run time only for modules compiled with /DEBUG=TRACEBACK and linked with the /TRACEBACK qualifier in effect (the default for both compiler and linker commands). You should exclude traceback information only from thoroughly debugged program modules.

The traceback information makes reference to numbered lines that are listing lines in your program. If you include header files in the source file using the #include directive, the line numbers do not correspond to the source-file lines. To see the numbers that correspond to those referenced in the traceback information, generate a listing file using the /LIST qualifier to the compiler command.

1.5.2 Passing Arguments to the main Function

The main function in a C++ program can accept arguments from the command line from which it was invoked. The syntax for a main function is as follows:

int main(int argc,
char *argv[],
char *envp[])
{
...
return status;
}

In this syntax, parameter argc is the count of arguments present in the command line that invoked the program, and parameter argv is a character-string array of the arguments. Parameter envp is the environment array, which contains process information such as the user name and controlling terminal. Parameter envp has no bearing on passing command-line arguments; its primary use in C++ programs is during exec and getenv function calls. For more information, see the HP C Run-Time Library Reference Manual for OpenVMS Systems.

In the main function definition, the parameters are optional. However, you can access only the parameters that you define. You can define the main function in any of the following ways:


int main() 
int main(int argc) 
int main(int argc, char *argv[]) 
int main(int argc, char *argv[], char *envp[]) 

To pass arguments to the main function, you can use a DCL foreign command to point to the program, or you can define the logical name DCL$PATH to point to an area containing the program.

To make use of DCL$PATH in the previous example, the resulting program executable would have to be named "echo.exe".

You can then place echo.exe into a specific directory and point the logical name DCL$PATH to it.

For example:


$ RENAME commarg.exe echo.exe 
$ COPY echo.exe sys$login: 
$ DEFINE DCL$PATH SYS$LOGIN: 

The output would be identical to that shown in the previous exaple when a foreign command was used. To pass arguments to the main function, you must define the program as a DCL foreign command. When a program is defined and run as a foreign command, the parameter argc is always greater than or equal to 1, and argv[0] always contains the name of the image file.

The procedure for defining a foreign command involves using a DCL assignment statement to assign the name of the image file to a symbol that is later used to invoke the image. For example:


$ echo == "$ dsk$:commarg.exe"[Return]

The symbol echo is defined as a foreign command that invokes the image in commarg.exe . The definition of echo must begin with a dollar sign ($) and include a device name.

For more information about the procedure for defining a foreign command, see the HP OpenVMS DCL Dictionary.

The following example shows a C++ program called commarg.cxx , which displays the command-line arguments that were used to invoke it:


// This program echoes the command-line arguments. 
 
#include <iostream.h> 
 
main(int argc, char *argv[]) 
{ 
        int i; 
        for (i = 0; i < argc; ++i) 
                cout << i << " := >" << argv[i] << "<\n"; 
        return 0; 
} 

A sample output for this example is as follows:


$ echo  Long  "Day's"  "Journey into Night"[Return]
0 := >db7:commarg.exe;1<
1 := >long<
2 := >Day's<
3 := >Journey into Night<

DCL converts unquoted arguments on the command line to uppercase letters. However, the C RTL internally parses the altered command line and puts all unquoted arguments back in lowercase. This makes access to arguments in HP C++ programs compatible with C++ programs developed on other systems.

All arguments in the command line are delimited by spaces or tabs. Arguments with embedded spaces or tabs must be enclosed in quotation marks (" ").

1.6 Name Demangling

Because of the need to provide type-safe linking, HP C++ encodes type information in external function names. This encoding is called name mangling.

Mangled names can appear in diagnostic messages from commands such as CXXLINK/NOEXPAND or from the OpenVMS Linker utility. To enable users to decode (or demangle) these names, the compiler provides the CXXDEMANGLE facility. The CXXDEMANGLE facility translates mangled names into the names as they originally appeared in C++ source code.

To do the translation, CXXDEMANGLE uses a data file written by the compiler during compilation. The data file contains a mapping of mangled names to their demangled forms.

1.6.1 Creating the Data File

Each time you compile a program, the compiler stores, in a data file, all the program's external symbols in their mangled and demangled forms. If the data file does not exist, the compiler creates the data file. Otherwise, the compiler appends information to the existing data file.

You can specify the name and location of the data file using the logical name CXX$DEMANGLER_DB. For example, if you want your data file to be named MYCXXDB.DAT in the DISK1:[MYDIR] directory, define the CXX$DEMANGLER_DB logical name as follows:


$ DEFINE CXX$DEMANGLER_DB DISK1:[MYDIR]MYCXXDB.DAT 

If the CXX$DEMANGLER_DB logical name is not defined, the compiler uses the default file name CXX$DEMANGLER_DB in the writeable repository. Refer to Chapter 5 for details on how to specify the writeable repository.

1.6.2 Using the CXXDEMANGLE Facility

To demangle a symbol name, CXXDEMANGLE must use the same data file as the compiler used when it compiled the program containing the symbol.

Hence, if you defined the CXX$DEMANGLER_DB logical name when you compiled the program, you should also define the logical name when you use the CXXDEMANGLE facility.

Similarly, if you did not define the CXX$DEMANGLER_DB logical name but specified the /REPOSITORY qualifier during compilation, specify the same /REPOSITORY qualifier on your CXXDEMANGLE command.

If you did not specify the /REPOSITORY qualifier on your compile command, the compiler uses the data file in the default writeable repository. To use the CXXDEMANGLE facility in this case, either issue the CXXDEMANGLE command from the same directory where the compile command was issued, or specify the appropriate /REPOSITORY qualifier on your CXXDEMANGLE command.

CXXDEMANGLE provides both a command-line interface and an interactive interface, as follows:

  • To use the command-line interface, enter the CXXDEMANGLE command followed by a comma-separated list of mangled symbol names. CXXDEMANGLE then displays the demangled form of each symbol and exits. The command-line interface has the following syntax:

    CXXDEMANGLE mangled-symbol-name [,...]


    The following example shows appropriate use of this syntax:


    $ CXXDEMANGLE COPY__XPIPIPI 
    int * copy(int *, int *, int *) 
    $ CXXDEMANGLE COPY__XPPCPPCPPC, CXX$ADJCNTDFFRNCXPPP9MNS0IUE0NU 
    char ** copy(char **, char **, char **) 
    int * adjacent_difference(int *, int *, int *, minus<int >) 
    $ 
    

    If you specify a mangled symbol name using the command-line interface and the symbol contains lowercase letters, you must place the symbol within quotes. For example:


    $ CXXDEMANGLE "MyFunction__xic" 
    

  • To use the interactive interface, enter the CXXDEMANGLE command without specifying a symbol name. CXXDEMANGLE then waits for you to enter a symbol name in its mangled form. When you enter a symbol, CXXDEMANGLE displays the demangled form of the symbol and waits for you to enter another symbol, and so forth. To exit the interactive interface, enter Ctrl/Z. The syntax for the interactive interface is as following:

    CXXDEMANGLE
    mangled-symbol-name
    [...]
    Ctrl/Z


    The following example shows appropriate use of this syntax:


    $ CXXDEMANGLE 
    COPY__XPIPIPI 
    int * copy(int *, int *, int *) 
    COPY__XPPCPPCPPC 
    char ** copy(char **, char **, char **) 
    CXX$ADJCNTDFFRNCXPPP9MNS0IUE0NU 
    int * adjacent_difference(int *, int *, int *, minus<int >) 
    Ctrl/Z 
    $ 
    

    When you use the interactive interface, quotes are not necessary when entering mangled symbol names that contain lowercase letters.

If CXXDEMANGLE is unable to translate a mangled symbol name, it echoes the mangled symbol name.

1.6.2.1 Command Qualifier

The CXXDEMANGLE command accepts a single qualifier, /REPOSITORY.

/REPOSITORY=(repository[,...])

Names the repository directories that contain the data files used by CXXDEMANGLE. The /REPOSITORY qualifier is ignored if you define the CXX$DEMANGLER_DB logical name. See the preceding text for details.

1.7 Performance Optimization Qualifiers

The following compiler qualifiers can be used to improve performance. However, they can also change behavior for nonstandard-compliant programs:

  • /[NO]ANSI_ALIAS---Specifies whether the compiler assumes the ANSI C aliasing rules to generate better optimized code. The default is /ANSI_ALIAS.
  • /ASSUME=[NO]POINTERS_TO_GLOBALS---Controls whether the compiler can safely assume that global variables have not had their addresses taken in code that is not visible to the current compilation. The default is /ASSUME=POINTERS_TO_GLOBALS.
  • /ASSUME=[NO]TRUSTED_SHORT_ALIGNMENT---Allows the compiler additional assumptions about the alignment of short types that, although naturally aligned, may cross a quadword boundary. The default is /ASSUME=NOTRUSTED_SHORT_ALIGNMENT.
  • /ASSUME=[NO]WHOLE_PROGRAM---Tells the compiler that except for "well-behaved library routines", the whole program consists only of the single object module being produced by this compilation. The optimizations enabled by /ASSUME=WHOLE_PROGRAM include all those enabled by /ASSUME=NOPOINTER_TO_GLOBALS and possibly other optimizations. The default is /ASSUME=NOWHOLE_PROGRAM.

You can use the /OPTIMIZE qualifier to improve performance. This qualifier will not change application behavior.

On I64 systems, the floating-point formats D_FLOAT, G_FLOAT, and F_FLOAT are emulated using IEEE_FLOAT. Because this can hinder performance, using the /FLOAT=IEEE_FLOAT default is recommended.

See Appendix A for detailed descriptions of these qualifiers.

1.8 Improving Build Performance

Partitioning a large application into several shared libraries, which are then linked into an executable, is a useful technique for reducing link times during development. See Section 3.5 for more information.

1.9 Deploying Your Application

The HP C++ kit contains two Run-Time Library components that you might need to redistribute with your applications:

  • C++ Standard Library Object Library (LIBCXXSTD)
  • C Run-Time Object Library (DECC$CRTL.OLB)

The next sections describe the method that developers must use to redistribute Run-Time Library components to user systems. Redistribution of other components on the HP C++ kit is prohibited. The redistribution rights set forth in the Software Product Description do not apply to the DECC$CRTL.EXE or DECC$CRTL.README files which are distributed with this kit.

1.9.1 Redistribution of the DECC$CRTL.OLB Object Library

Redistribution of this library is only required by those applications which need to be linked during or after installation on an end user target system. If you link your application and ship either a shareable or executable image to your customers, then redistribution of the object library is not necessary. The linking process of your application causes those library modules to be incorporated into your resultant image.

There are two options that you can use to redistribute the DECC$CRTL.OLB object library. The options are based on whether the library is needed after the installation is completed.

The first option is for applications which link during installation, but have no need for the object library once installation is completed. For that set of developers, we recommend placing DECC$CRTL.OLB on your kit, but to link using the copy in VMI$KWD and not issue a PROVIDE_FILE option which would move this file onto the system. In other words, the object library resides only on your kit, is used during installation to link your application, but is not placed onto the end user system.

The second option is for applications which do need the object library after installation is completed. For this class of applications, the object library should be placed in a product specific location on the target system and not in SYS$LIBRARY. The contents of this object library must not be inserted into the SYS$LIBRARY:STARLET.OLB library.

1.9.2 Redistribution of the LIBCXXSTD.OLB Object Library

Redistribution of this library is only required by those applications which need to be linked during or after installation on an end user target system. If you link your application and ship either a shareable or executable image to your customers, then redistribution of the object library is not necessary. The linking process of your application causes those library modules to be incorporated into your resultant image.

There are two options that you can be used to redistribute the LIBCXXSTD.OLB object library. The options are based on whether the library is needed after the installation is completed.

The first option is for applications which link during installation, but have no need for the object library once installation is completed. For that set of developers, we recommend placing LIBCXXSTD.OLB on your kit, but to link using the copy in VMI$KWD and not issue a PROVIDE_FILE option which would move this file onto the system. In other words, the object library resides only on your kit, is used during installation to link your application, but is not placed onto the end user system.

The second option is for applications that do need the object library after installation is completed. For this class of applications, the object library should be placed in a product specific location on the target system and not in SYS$LIBRARY. The contents of this object library must not be inserted into the SYS$LIBRARY:STARLET.OLB library.


Previous Next Contents Index

Privacy statement Using this site means you accept its terms
© 2007 Hewlett-Packard Development Company, L.P.