United States    
COMPAQ STORE | PRODUCTS |
SERVICES | SUPPORT | CONTACT US | SEARCH
Compaq C

Compaq C
User's Guide for OpenVMS Systems


Previous Contents Index

This qualifier directs the compiler to flag certain Compaq C-specific constructs and Compaq C relaxations of conventional C language constructs and rules. For example, the conversions from pointer to integer and back again are subject to more stringent tests when you specify /STANDARD=ANSI89.

The /STANDARD qualifier options are mutually exclusive. Do not combine them.

If you specify /STANDARD without an option, the default is /STANDARD= ANSI89.

The default is /NOSTANDARD, which is equivalent to /STANDARD= RELAXED_ANSI89.

With one exception, the /STANDARD qualifier options are mutually exclusive. Do not combine them. The exception is that you can specify /STANDARD=ISOC94 with any other option except VAXC.

Compaq C modules compiled in different modes can be linked and executed together.

Also see the __hide_forbidden_names predefined macro ( Section 6.1.7).

/[NO]TIE (ALPHA ONLY)

Enables the compiled code to be used in combination with translated images, either because the code might call into a translated image or might be called from a translated image. The default is /NOTIE.

/[NO]UNDEFINE=(identifier[,...])

See /[NO]DEFINE in this section.

/[NO]UNSIGNED_CHAR

By default, char is a signed character type. The /UNSIGNED_CHAR qualifier lets you change this default to an unsigned character type, which causes all plain char declarations to have the same representation and set of values as unsigned char declarations. The default is /NOUNSIGNED_CHAR.

/VAXC (VAX ONLY)

Invokes the VAX C compiler.

The CC command is used to invoke either the VAX C or Compaq C compiler. If your system has a VAX C compiler installed on it, the Compaq C installation procedure provides the option of specifying which compiler will be invoked by default when just the CC command is used. To invoke the compiler that is not the default, use the CC command with the appropriate qualifier: CC/DECC for the Compaq C compiler, or CC/VAXC for the VAX C compiler.

If your system does not have a VAX C compiler installed on it, the CC command will invoke the Compaq C compiler, and the /VAXC qualifier is not supported.

/[NO]VERSION

Directs the compiler to print out the compiler version and platform. The compiler version is the same as in the listing file.

This qualifier makes it easier for you to report what compiler you are using.

Note

To display the compiler version and platform when issuing the CC command for a source file that does not exist, enter:


CC/DECC/VERSION NL: 

/[NO]WARNINGS[=(option[,...])]

Controls the issuance of compiler diagnostic messages or groups of messages. It also allows for the severity of messages to be modified. The default qualifier, /WARNINGS, enables all warning and informational messages for the compiler mode you are using. The /NOWARNINGS qualifier suppresses the warning and informational messages. Also see the #pragma message preprocessor directive.

Table 1-24 describes the /WARNING qualifier options.

Table 1-24 /WARNINGS Qualifier Options
Option Usage
DISABLE= message-list Suppresses the issuance of the specified messages.

A description of message-list follows this table.

Only messages of severity Warning (W) or Information (I) can be disabled. If the message has severity of Error (E) or Fatal (F), it is issued regardless of any attempt to disable it.

ENABLE= message-list Enables issuance of the specified messages.
NOINFORMATIONALS Suppresses informational messages.
EMIT_ONCE= message-list Emits the specified messages only once per compilation.

Certain messages are emitted only the first time the compiler encounters the causal condition. When the compiler encounters the same condition later in the program, no message is emitted. Messages about the use of language extensions are an example of this kind of message. To emit one of these messages every time the causal condition is encountered, use the EMIT_ALWAYS option.

Errors and Fatals are always emitted. You cannot set them to EMIT_ONCE.

EMIT_ALWAYS= message-list Emits the specified messages at every occurrence of the causal condition.
ERRORS= message-list Sets the severity of the specified messages to Error.

Supplied Error messages and Fatal messages cannot be made less severe. (Exception: A message can be upgraded from Error to Fatal, then later downgraded to Error again, but it can never be downgraded from Error.)

Warnings and Informationals can be made any severity.

FATALS= message-list Sets the severity of the specified messages to Fatal.
INFORMATIONALS= message-list Sets the severity of the specified messages to Informational. Note that Fatal and Error messages cannot be made less severe.
WARNINGS= message-list Sets the severity of the specified messages to Warning. Note that Fatal and Error messages cannot be made less severe.
VERBOSE Displays the full message information for every compiler message encountered. This information includes the message description and user action, as well as the identifier, severity, and message text.

When /WARNINGS=VERBOSE is used with /LIST/SHOW=MESSAGES, a list of all messages in effect at compilation are added to the listing file, showing the full information for each message.

For a description of what to specify for the message-list, see the #pragma message preprocessor directive ( Section 5.4.12).

Notes

  • If a message is on both the enabled and disabled list, it is disabled.
  • If a message is on both the EMIT_ONCE and the EMIT_ALWAYS list, it is considered to be on the EMIT_ONCE list.
  • If a message is on more than one of the FATALS, ERRORS, WARNINGS, or INFORMATIONALS lists, the message is given the least severe level.
  • The NOINFORMATIONALS option is not the negation of INFORMATIONALS=msg-list. It is valid to specify:


    /WARNINGS=(INFORMATIONALS=message_list,NOINFORMATIONALS) 
    


    This has the effect of making the messages on the message_list informationals, and causing the compiler to suppress any informational messages.

  • One of the message groups described in the #pragma message description in Section 5.4.12 is UNUSED, which enables messages that report apparently unnecessary #include files and CDD records.

    However, unlike any other messages, these messages must be enabled on the command line (/WARNINGS=ENABLE=UNUSED) to be effective. Any #pragma message directives within the source have no effect on these messages; their state is determined only by processing the command line.

The default is /WARNINGS=ENABLE=LEVEL3.

1.3.5 Compiler Diagnostic Messages

If there are errors in your source file when you compile your program, the Compaq C compiler signals these errors and displays diagnostic messages. Reference the message, locate the error, and, if necessary, correct the error. See Appendix D or the online help for a description of all compiler diagnostic messages.

You can control the issuance of specific compiler diagnostic messages or groups of messages with the /[NO]WARNINGS command-line qualifier ( Section 1.3.4) and the #pragma message preprocessor directive ( Section 5.4.12).

To display a particular compiler diagnostic message online, enter the following command:


$ HELP CC/DECC MESSAGE mnemonic[Return]  (VAX ONLY)
$ HELP CC MESSAGE mnemonic[Return]  (ALPHA ONLY)

To display a list of all message mnemonics, enter the following command:


$ HELP CC/DECC MESSAGE[Return]  (VAX ONLY)
$ HELP CC MESSAGE[Return]  (ALPHA ONLY)

Diagnostic messages have the following format:

%CC-s-ident, message-text
Listing line number m
At line number n in name

%CC

The facility or program name of the Compaq C compiler. This portion indicates that the message is being issued by Compaq C.

s

The severity of the error, represented in the following way:
F Fatal error. The compiler stops executing when a fatal error occurs and does not produce an object module. You must correct the error before you can compile the program.
E Error. The compiler continues, but does not produce an object module. You must correct the error before you can successfully compile the program.
W Warning. The compiler produces an object module. It attempts to correct the error in the statement, but you should verify that the compiler's action is acceptable. Otherwise, your program may produce unexpected results.
I Information. This message usually appears with other messages to inform you of specific actions taken by the compiler. No action is necessary on your part.

ident

The message identification. This is a descriptive abbreviation (mnemonic) of the message text.

message-text

The compiler's message. In many cases, it consists of more than one line of output. A message generally provides you with enough information to determine the cause of the error so that you can correct it.

Listing line number m

The integer m, which gives you the line number in the listing file where the error occurs. This information is given when you specify the /LIST qualifier.

At line number n in name

The integer n, which gives you the number of the line where the error occurs. The number is relative to the beginning of the file or text library module specified by name. You can use the #line directive to change both the line number and name that appear in the message.

1.4 Linking a Compaq C Program

After you compile a Compaq C source program or module, use the DCL command LINK to combine your object modules into one executable image, which can then be executed by the OpenVMS system. A source program or module cannot run on the OpenVMS system until it is linked.

When you execute the LINK command, the linker performs the following functions:

When using the LINK command on development systems, use the /DEBUG qualifier to link your program module. The /DEBUG qualifier appends to the image all the symbol and line number information appended to the object modules plus information on global symbols, and causes the image to run under debugger control when it is executed.

The LINK command produces an executable image by default. However, you can also use the LINK command to obtain shareable images and system images. The /SHAREABLE qualifier directs the linker to produce a shareable image; the /SYSTEM qualifier directs the linker to produce a system image. See Section 1.4.2 for a complete description of these and other LINK command qualifiers.

For a complete discussion of the OpenVMS Linker, see the OpenVMS Linker Utility Manual.

1.4.1 The LINK Command

The LINK command has the following format:

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

/command-qualifier...

Output file options.

file-spec

The input files to be linked.

/file-qualifier...

Input file options.

If you specify more than one input file, you must separate the input file specifications with a plus sign (+) or a comma (,).

By default, the linker creates an output file with the name of the first input file specified and the file type EXE. If you link more than one file, you should specify the file containing the main program first. Then, the name of your output file will have the same name as your main program module.

The execution of a program will begin at the function whose identifier is main , or, if there is no function with this identifier, at the first function seen by the VMS linker.

Note

Unexpected results might occur if you don't have a function called main .

The following command line links the object files MAINPROG.OBJ, SUBPROG1.OBJ, and SUBPROG2.OBJ to produce one executable image called MAINPROG.EXE:


$ LINK MAINPROG.OBJ, SUBPROG1.OBJ, SUBPROG2.OBJ

Note

Unlike VAX C, Compaq C does not require you to define any LNK$LIBRARY logicals.

1.4.2 LINK Command Qualifiers

You can use the LINK command qualifiers to modify the linker's output, as well as to invoke the debugging and traceback facilities. Linker output consists of an image file and an optional map file.

The following list summarizes some of the most commonly used LINK command qualifiers. A brief description of each qualifier follows this list. For a complete list of LINK qualifiers, see the OpenVMS Linker Utility Manual.
Command Qualifiers Default
/BRIEF None.
/[NO]CROSS_REFERENCE /NOCROSS_REFERENCE
/[NO]DEBUG /NODEBUG
/[NO]EXECUTABLE[=file-spec] /EXECUTABLE=name.EXE
/FULL None.
/[NO]MAP /MAP (batch) /NOMAP (interactive)
/[NO]SHAREABLE[=file-spec] /NOSHAREABLE
/[NO]TRACEBACK /TRACEBACK

/BRIEF

Produces a summary of the image's characteristics and a list of contributing modules. This qualifier is mutually exclusive with /FULL.

/[NO]CROSS_REFERENCE

Produces cross-reference information for global symbols; /NOCROSS_REFERENCE suppresses cross-reference information. The default is /NOCROSS_REFERENCE.

/[NO]DEBUG

Includes the OpenVMS Debugger in the executable image and generates a symbol table; /NODEBUG causes the linker to prevent debugger control of the program. The default is /NODEBUG.

/[NO]EXECUTABLE [=file-spec]

Produces an executable image. /NOEXECUTABLE suppresses production of an image file. The default is /EXECUTABLE.

/FULL

Produces a summary of the image's characteristics, a list of contributing modules, listings of global symbols by name and by value, and a summary of characteristics of image sections in the linked image. This qualifier is mutually exclusive with /BRIEF.

/[NO]MAP

Generates a map file; /NOMAP suppresses the map. The default is /MAP in batch mode and /NOMAP in interactive mode.

/[NO]SHAREABLE[=file-spec]

Creates a shareable image. /NOSHAREABLE generates an executable image. The default is /NOSHAREABLE.

/[NO]TRACEBACK

Generates symbolic traceback information when error messages are produced; NOTRACEBACK suppresses traceback information. The default is /TRACEBACK.

1.4.3 Linker Input Files

You can specify the object modules to be included in an executable image in any of the following ways:

Table 1-25 shows the default input file types for the linker.

Table 1-25 OpenVMS Linker Default File Types for Input Files
File Type File
OBJ Object module
OLB Library
OPT Options file

1.4.4 Linker Output Files

When you enter the LINK command interactively and do not specify any qualifiers, the linker creates only an executable image file. By default, the resulting image file has the same file name as that of the first object module specified with a file type of EXE.

In a batch job, the linker creates both an executable image file and storage map file by default. The default file type for map files is MAP.

To specify an alternative name for a map file or image file or to specify an alternative output directory or device, you can include a file specification on the /MAP or /EXECUTABLE qualifier. In the following example, the LINK command creates the image file [PROJECT.EXE]UPDATE.EXE and the map file [PROJECT.MAP]UPDATE.MAP:


$ LINK UPDATE/EXECUTABLE=[PROJECT.EXE]/MAP=[PROJECT.MAP]

1.4.5 Linking Against Object Module Libraries and Shareable Images

Linking against object modules (stored in object module libraries) or against shareable images are ways of allowing your program to access data and routines outside of your compilation units. You can either create the object module libraries and the shareable images or use the ones provided by DIGITAL. To access data in object modules and shareable images, you can use LINK command qualifiers, OpenVMS logical names, and options files. For more information about object module libraries, see the OpenVMS Linker Utility Manual.

The Compaq C Run-Time Library (RTL) for OpenVMS systems also provides two formats for you to choose from: shareable images or object module libraries. Depending on which type of RTL you want to use and on which type of functions you plan on calling from your programs, you need to supply information to the linker that specifies which versions of the functions to access.

When you use the Compaq C RTL and its corresponding header files, remember that the Compaq C RTL ships with the OpenVMS operating system and the header files ship with the Compaq C compiler. Since the releases of the compiler and of the operating system are not synchronized, there may be compatibility issues that you need to consider to use the RTL properly. See the Compaq C release notes (by entering HELP CC/DECC RELEASE_NOTES on the DCL command line) for information that may pertain to this issue.

For a description of the various ways to link with the Compaq C RTL, see the Compaq C Run-Time Library Reference Manual for OpenVMS Systems.

1.4.6 Object Module Libraries

You can make program modules accessible to other users by storing them in an object module library. To link modules contained in an object module library, use the /INCLUDE qualifier and specify the modules you want to link. The following example links the subprogram modules EGGPLANT, TOMATO, BROCCOLI, and ONION with the main program module GARDEN:


$ LINK GARDEN, VEGGIES/INCLUDE=(EGGPLANT,TOMATO,BROCCOLI,ONION)

An object module library can also contain a symbol table with the names of each global symbol in the library, and the name of the module in which they are defined. You specify the name of the object module library containing symbol definitions with the /LIBRARY qualifier. When you use the /LIBRARY qualifier during a linking operation, the linker searches the specified library for all unresolved references found in the included modules during compilation.

The following example uses the library RACQUETS to resolve undefined symbols in BADMINTON, TENNIS, and RACQUETBALL:


$ LINK BADMINTON, TENNIS, RACQUETBALL, RACQUETS/LIBRARY

You can define an object module library to be your default library by using the DCL command DEFINE LNK$LIBRARY. The linker searches default user libraries for unresolved references after it searches modules and libraries specified in the LINK command. For more information about the DEFINE command, see the OpenVMS DCL Dictionary.

For more information about object module libraries, see the OpenVMS Linker Utility Manual.


Previous Next Contents Index
  

1.800.AT.COMPAQ

privacy and legal statement