Order Number: AA-PUNZF-TK
November 1996
This guide describes using the DEC C compiler on OpenVMS systems. It contains information on DEC C program development in the OpenVMS environment, DEC C features specific to OpenVMS systems, and cross-system portability concerns.
Revision Update Information: | This revised guide supersedes the DEC C User's Guide for OpenVMS Systems (Order No. AA- PUNZE-TK) |
Software Version: | DEC C Version 5.5 for OpenVMS Systems |
Digital Equipment Corporation
Maynard, Massachusetts
©Digital Equipment Corporation 1992, 1993, 1994, 1995, 1996. All Rights Reserved.
This document was produced using SDMLWEB.
1.2.2 The EVE Interface to DECTPU
1.3.1.2 Listing Header Files
1.3.3 Microsoft Compatibility Compilation Mode
1.3.3.2 Duplicate typedefs
1.3.3.3 Compatible typedefs
1.3.3.4 Structs with Trailing Incomplete Array
1.3.3.5 Block Scope Declaration of static Functions
1.3.3.6 Treat &* as Having No Effect
1.3.3.7 Integer and Pointer Comparisons without a Cast
1.3.3.8 char is Not Treated as a Unique Type
1.3.3.9 Double Semicolons in Declarations
1.3.3.10 Declaration without a Type
1.3.3.11 Enumerators in an Enumeration Declaration
1.3.3.12 Useless Typedefs
1.3.3.13 Unrecognized Pragmas Accepted
1.3.5 Compiler Diagnostic Messages
1.4.2 LINK Command Qualifiers
1.4.3 Linker Input Files
1.4.4 Linker Output Files
1.4.5 Linking Against Object Module Libraries and Shareable Images
1.4.6 Object Module Libraries
1.4.7 Linker Error Messages
1.6 Passing Arguments to the main Function
1.7 64-bit Addressing Support (Alpha only)
1.7.1.2 The __INITIAL_POINTER_SIZE Macro
1.7.1.3 The /CHECK=POINTER_SIZE Qualifier
1.7.1.4 Pragmas
1.7.2.2 Mixing Pointer Sizes
1.7.4 Prologue/Epilogue Files
1.7.4.2 Using Prologue/Epilogue Files
1.7.6 Examples
2 Using OpenVMS Record Management Services
2.1.2 Relative File Organization
2.1.3 Indexed File Organization
2.4 RMS Functions
2.5 Writing DEC C Programs Using RMS
2.5.2 Initializing Record Access Blocks
2.5.3 Initializing Extended Attribute Blocks
2.5.4 Initializing Name Blocks
3 Using DEC C in the Common Language Environment
3.1.2 Return of the Function Value
3.1.3 The Argument List
3.2.2 Passing Arguments by Reference
3.2.3 Passing Arguments by Descriptor
3.2.4 DEC C Default Parameter-Passing Mechanisms
3.3.2 Calling VAX MACRO
3.3.3 Calling VAX BASIC
3.3.4 Calling VAX Pascal
3.4.2 Sharing Program Sections with PL/I Externals
3.4.3 Sharing Program Sections with MACRO Programs
3.6 OpenVMS System Services Routines
3.7 Calling Routines
3.7.2 Declaring an External Routine and Its Arguments
3.7.3 Calling the External Routine
3.7.4 System Routine Arguments
3.7.5 Symbol Definitions
3.7.6 Condition Values
3.7.7 Checking System Service Return Values
3.9.2 Manipulating Return Status Values
3.9.3 Testing for Success or Failure
3.9.4 Testing for Specific Return Status Values
4 Data Storage and Representation
4.2 ANSI-Compliant Method of Controlling External Objects
4.3.2 Comparing the Global and the External Storage Classes
4.3.3 The globalvalue Specifier
4.4.2 The readonly Modifier
4.4.3 The _align Modifier
4.4.4 The __inline Modifier (Alpha only)
4.7.2 Bit-Field Initialization
4.7.3 Variant Structures and Unions
4.8.2 Program Sections Created by DEC C
5.2.2 Inclusion Using Quotation Marks
5.2.3 Inclusion of Text Modules
5.2.4 Macro Substitution in #include Directives
5.4 Implementation-Specific Preprocessor Directive (#pragma)
5.4.2 #pragma dictionary Directive
5.4.3 #pragma environment Directive
5.4.4 #pragma extern_model Directive
5.4.4.2 #pragma extern_model common_block
5.4.4.3 #pragma extern_model relaxed_refdef
5.4.4.4 #pragma extern_model strict_refdef
5.4.4.5 #pragma extern_model globalvalue
5.4.4.6 #pragma extern_model save
5.4.4.7 #pragma extern_model restore
5.4.4.8 Effects on the DEC C Run-Time Library and User Programs
5.4.4.9 Example
5.4.6 #pragma [no]inline Directive
5.4.7 #pragma intrinsic Directive (Alpha only)
5.4.8 #pragma linkage Directive (Alpha only)
5.4.9 #pragma [no]member_alignment Directive
5.4.10 #pragma message Directive
5.4.11 #pragma module Directive
5.4.12 #pragma pack Directive
5.4.13 #pragma pointer_size Directive (Alpha only)
5.4.14 #pragma required_pointer_size Directive (Alpha only)#pragma [no]standard Directive
5.4.16 #pragma use_linkage Directive (Alpha only)
6 Predefined Macros and Built-In Functions
6.1.2 System Identification Macros
6.1.2.2 The __VMS_VER Macro
6.1.4 Floating-Point Macros
6.1.5 Compiler-Mode Macros
6.1.6 Pointer-Size Macro
6.1.7 The __HIDE_FORBIDDEN_NAMES Macro
6.2.1.2 Intrinsic Functions-ASMs
6.2.1.3 Absolute Value ( __ABS)
6.2.1.4 Acquire and Release Longword Semaphore (__ACQUIRE_SEM_LONG, __RELEASE_SEM_LONG)
6.2.1.5 Add Aligned Word Interlocked ( __ADAWI)
6.2.1.6 Add Atomic Longword ( __ADD_ATOMIC_LONG)
6.2.1.7 Add Atomic Quadword ( __ADD_ATOMIC_QUAD)
6.2.1.8 Allocate Bytes from Stack ( __ALLOCA)
6.2.1.9 AND Atomic Longword ( __AND_ATOMIC_LONG)
6.2.1.10 AND Atomic Quadword ( __AND_ATOMIC_QUAD)
6.2.1.11 Atomic Add Longword (__ATOMIC_ADD_LONG)
6.2.1.12 Atomic Add Quadword (__ATOMIC_ADD_QUAD)
6.2.1.13 Atomic AND Longword (__ATOMIC_AND_LONG)
6.2.1.14 Atomic AND Quadword (__ATOMIC_AND_QUAD)
6.2.1.15 Atomic OR Longword (__ATOMIC_OR_LONG)
6.2.1.16 Atomic OR Quadword (__ATOMIC_OR_QUAD)
6.2.1.17 Atomic Increment Longword (__ATOMIC_INCREMENT_LONG)
6.2.1.18 Atomic Increment Quadword (__ATOMIC_INCREMENT_QUAD)
6.2.1.19 Atomic Decrement Longword (__ATOMIC_DECREMENT_LONG)
6.2.1.20 Atomic Decrement Quadword (__ATOMIC_DECREMENT_QUAD)
6.2.1.21 Atomic Exchange Longword (__ATOMIC_EXCH_LONG)
6.2.1.22 Atomic Exchange Quadword (__ATOMIC_EXCH_QUAD)
6.2.1.23 Compare Store Longword ( __CMP_STORE_LONG)
6.2.1.24 Compare Store Quadword ( __CMP_STORE_QUAD)
6.2.1.25 Convert G_Floating to F_Floating Chopped ( __CVTGF_C)
6.2.1.26 Convert G_Floating to Quadword ( __CVTGQ)
6.2.1.27 Convert IEEE T_Floating to IEEE S_Floating Chopped ( __CVTTS_C)
6.2.1.28 Convert IEEE T_Floating to Quadword ( __CVTTQ)
6.2.1.29 Convert X_Floating to Quadword ( __CVTXQ)
6.2.1.30 Convert X_Floating to IEEE T_Floating Chopped ( __CVTXT_C)
6.2.1.31 Copy Sign Built-in Functions
6.2.1.32 Cosine ( __COS)
6.2.1.33 Double-Precision, Floating-Point Arithmetic Built-in Functions
6.2.1.34 Floating-Point Absolute Value ( __FABS)
6.2.1.35 Long Double-Precision, Floating-Point Arithmetic Built-in Functions
6.2.1.36 Longword Absolute Value ( __LABS)
6.2.1.37 Lock and Unlock Longword (__LOCK_LONG, __UNLOCK_LONG)
6.2.1.38 Memory Barrier ( __MB)
6.2.1.39 Memory Copy and Set Functions ( __MEMCPY, __MEMMOVE, __MEMSET)
6.2.1.40 OR Atomic Longword ( __OR_ATOMIC_LONG)
6.2.1.41 OR Atomic Quadword ( __OR_ATOMIC_QUAD)
6.2.1.42 Privileged Architecture Library Code Instructions
6.2.1.43 __PAL_BPT
6.2.1.44 __PAL_BUGCHK
6.2.1.45 __PAL_CFLUSH
6.2.1.46 __PAL_CHME
6.2.1.47 __PAL_CHMK
6.2.1.48 __PAL_CHMS
6.2.1.49 __PAL_CHMU
6.2.1.50 __PAL_DRAINA
6.2.1.51 __PAL_GENTRAP
6.2.1.52 __PAL_HALT
6.2.1.53 __PAL_INSQHIL
6.2.1.54 __PAL_INSQHILR
6.2.1.55 __PAL_INSQHIQ
6.2.1.56 __PAL_INSQHIQR
6.2.1.57 __PAL_INSQTIL
6.2.1.58 __PAL_INSQTILR
6.2.1.59 __PAL_INSQTIQ
6.2.1.60 __PAL_INSQTIQR
6.2.1.61 __PAL_INSQUEL
6.2.1.62 __PAL_INSQUEL_D
6.2.1.63 __PAL_INSQUEQ
6.2.1.64 __PAL_INSQUEQ_D
6.2.1.65 __PAL_LDQP
6.2.1.66 __PAL_STQP
6.2.1.67 __PAL_MFPR_XXXX
6.2.1.68 __PAL_MTPR_XXXX
6.2.1.69 __PAL_PROBER
6.2.1.70 __PAL_PROBEW
6.2.1.71 __PAL_RD_PS
6.2.1.72 __PAL_REMQHIL
6.2.1.73 __PAL_REMQHILR
6.2.1.74 __PAL_REMQHIQ
6.2.1.75 __PAL_REMQHIQR
6.2.1.76 __PAL_REMQTIL
6.2.1.77 __PAL_REMQTILR
6.2.1.78 __PAL_REMQTIQ
6.2.1.79 __PAL_REMQTIQR
6.2.1.80 __PAL_REMQUEL
6.2.1.81 __PAL_REMQUEL_D
6.2.1.82 __PAL_REMQUEQ
6.2.1.83 __PAL_REMQUEQ_D
6.2.1.84 __PAL_SWPCTX
6.2.1.85 __PAL_SWASTEN
6.2.1.86 __PAL_WR_PS_SW
6.2.1.87 Read Process Cycle Counter ( __RPCC)
6.2.1.88 Sine ( __SIN)
6.2.1.89 Single-Precision, Floating-Point Arithmetic Built-in Functions
6.2.1.90 Test for Bit Clear then Clear Bit Interlocked (__INTERLOCKED_TESTBITCC_QUAD)
6.2.1.91 Test for Bit Clear then Clear Bit Interlocked (__TESTBITCCI)
6.2.1.92 Test for Bit Set Then Set Bit Interlocked (__INTERLOCKED_TESTBITSS_QUAD)
6.2.1.93 Test for Bit Set then Set Bit Interlocked (__TESTBITSSI)
6.2.1.94 Trap Barrier Instruction ( __TRAPB)
6.2.1.95 Unsigned Quadword Multiply High ( __UMULH)
6.2.2.2 Branch on Bit Clear-Clear Interlocked ( _BBCCI)
6.2.2.3 Branch on Bit Set-Set Interlocked ( _BBSSI)
6.2.2.4 Find First Clear Bit ( _FFC)
6.2.2.5 Find First Set Bit ( _FFS)
6.2.2.6 Halt ( _HALT)
6.2.2.7 Insert Entry into Queue at Head Interlocked ( _INSQHI)
6.2.2.8 Insert Entry into Queue at Tail Interlocked ( _INSQTI)
6.2.2.9 Insert Entry in Queue ( _INSQUE)
6.2.2.10 Locate Character ( _LOCC)
6.2.2.11 Move from Processor Register ( _MFPR)
6.2.2.12 Move Character 3 Operand ( _MOVC3)
6.2.2.13 Move Character 5 Operand ( _MOVC5)
6.2.2.14 Move from Processor Status Longword ( _MOVPSL)
6.2.2.15 Move to Processor Register ( _MTPR)
6.2.2.16 Probe Read Accessibility ( _PROBER)
6.2.2.17 Probe Write Accessibility ( _PROBEW)
6.2.2.18 Read General-Purpose Register ( _READ_GPR)
6.2.2.19 Remove Entry from Queue at Head Interlocked ( _REMQHI)
6.2.2.20 Remove Entry from Queue at Tail Interlocked ( _REMQTI)
6.2.2.21 Remove Entry from Queue ( _REMQUE)
6.2.2.22 Scan Characters ( _SCANC)
6.2.2.23 Skip Character ( _SKPC)
6.2.2.24 Span Characters ( _SPANC)
A.1.2 Comment Processing
A.1.3 String Literal Concatenation
A.1.4 Recursive main() Function
A.1.5 Trigraph Sequences
A.1.6 Alert Escape Sequence
A.1.7 Hexadecimal Escape Sequence
A.1.8 Invalid Escape Sequences
A.1.9 $ in Macro Names
A.1.10 Null Arguments to Macros
A.1.11 ANSI C Name Space Conformance
A.1.11.2 Non-ANSI Predefined Macros
A.1.11.3 Non-ANSI Identifiers in Standard-Specified Header Files
A.1.13 DEC C Types
A.1.13.2 Removal of the long float Type
A.1.13.3 Addition of the long double Type
A.1.13.4 Addition of Processor-Specific Integer Data Types
A.1.15 Type Compatibility
A.1.16 Composite Types
A.1.17 Enumerations Have Type int
A.1.18 long double Constants
A.1.19 Implicit Unsigned Integer Constants
A.1.20 Multibyte and Wide Character Support
A.1.20.2 Multibyte Characters in Comments, Character Constants, and String Literals
A.1.20.3 Wide Character Constants
A.1.20.4 Wide String Literals
A.1.22 Indexing as a Commutative Operator
A.1.23 Cast Operators
A.1.24 Function Calls
A.1.24.2 Passing Narrow Types to Old Syntax Functions
A.1.26 Unary Plus
A.1.27 Relational Operators
A.1.28 Assignment Compatibility
A.1.29 Declarations
A.1.29.2 Identifier Name Length
A.1.29.3 Diagnosing Empty Declarations
A.1.29.4 Restriction on Placement of Storage-Class Specifiers
A.1.29.5 Diagnosing Old-Style Function Declarations
A.1.29.6 Function Definitions Using typedef-names
A.1.29.7 Initialization
A.1.31 The Preprocessor
A.1.31.2 The #define Directive and Macro Substitution
A.1.31.3 The #line Directive
A.1.31.4 The #error Directive
A.1.31.5 The #pragma dictionary Directive
A.1.31.6 The #pragma extern_model Directive
A.1.31.7 The #pragma linkage Directive (Alpha only)
A.1.31.8 The #pragma use_linkage Directive (Alpha only)
A.1.31.9 The #pragma message Directive
A.1.31.10 The #pragma module Directive
A.2.2 <ctype.h>
A.2.3 <fp_class.h>
A.2.4 <locale.h>
A.2.5 <math.h>
A.2.6 <signal.h>
A.2.7 <stdio.h>
A.2.8 <stdlib.h>
A.2.9 <string.h>
A.2.10 <time.h>
C.1.2 Starting and Terminating a Debugging Session
C.1.3 Notes on DEC C Support
C.1.3.2 Accessing Scalar Variables
C.1.3.3 Accessing Arrays
C.1.3.4 Accessing Character Strings
C.1.3.5 Accessing Structures and Unions
C.1.3.6 Sample Debugging Session
C.3 Language-Sensitive Editor and the Source Code Analyzer
C.3.2 Starting and Terminating an LSE or an SCA Session
C.3.3 Programming Language Placeholders and Tokens
C.3.4 Compiling Source Code
C.3.5 LSE Examples
C.3.5.2 Preprocessor Lines
C.4.2 Accessing CDD/Repository from DEC C Programs
C.4.3 Support for CDD/Repository Data Types
Examples
1-2 Watch Out for Pointers to Pointers (**)
1-3 Trivial 64-Bit Exploitation
1-4 Preceding Example No Longer Trivial
2-1 External Data Declarations and Definitions
2-3 Function Initializing RMS Data Structures
2-5 Utility Function: Adding Records
2-6 Utility Function: Deleting Records
2-7 Utility Function: Typing the File
2-8 Utility Function: Printing the File
2-9 Utility Function: Updating the File
3-1 Passing Floating-Point Arguments by Immediate Value
3-2 Passing Arguments by Reference
3-3 Passing Arguments by Descriptor
3-4 Passing Compile-Time String Descriptors
3-5 DEC C Function Calling a VAX FORTRAN Subprogram
3-6 VAX FORTRAN Subprogram Calling a DEC C Function
3-7 DEC C Function Emulating a VAX FORTRAN CHARACTER*(*) Function
3-8 VAX MACRO Program Calling a DEC C Function
3-9 DEC C Program Calling a VAX MACRO Program
3-10 DEC C Function Calling a VAX BASIC Function
3-11 VAX BASIC Program Calling a DEC C Function
3-12 DEC C Function Calling a VAX Pascal Routine
3-13 VAX Pascal Program Calling a DEC C Function
3-14 Sharing Data with a FORTRAN Program in Named Program Sections
3-15 Sharing Data with a FORTRAN Program in a DEC C Structure
3-16 Sharing Data with a PL/I Program in Named Program Sections
3-17 Sharing Data with a PL/I Program in a DEC C Structure
3-18 Sharing Data with a MACRO Program in a DEC C Structure
3-19 Checking System Service Return Values
3-20 Using Variable-Length Argument Lists
3-21 Testing for Success
3-22 Testing for Specific Return Status Values
3-23 Passing Arguments to System Services
3-24 Determining $QIO Completion
3-25 Using Time Routines
4-2 Using the globalvalue Specifier
5-1 #pragma extern_model Example
C-1 Debugging Sample Program SCALARS.C
C-2 Debugging Sample Program ARRAY.C
C-3 Debugging Sample Program STRING.C
C-4 Debugging Sample Program STRUCT.C
C-5 Debugging Sample Program ARSTRUCT.C
C-6 Debugging Sample Program POWER.C
C-7 A Sample Debugging Session
Figures
3-1 The Call Stack
3-2 Structure of an OpenVMS VAX Argument List
3-3 Example of an OpenVMS VAX Argument List
3-4 Passing Arguments by Immediate Value
3-5 Bit Fields Within a Return Status Value
3-6 Internal Representation of a Status Value
4-1 OpenVMS VAX Structure Alignment
4-2 OpenVMS Bit-Field Alignment
Tables
1-3 /CHECK=POINTER_SIZE Qualifier Options
1-4 /COMMENTS Qualifier Options
1-5 Debugger Compilation Options
1-6 /EXTERN_MODEL Qualifier Options
1-9 /MACHINE_CODE Qualifier Options (VAX only)
1-10 /MMS_DEPENDENCIES Qualifier Options
1-12 /NESTED_INCLUDE_DIRECTORY Qualifier Options
1-13 /OPTIMIZE Qualifier Options
1-14 /PDSC_MASK Qualifier Options
1-15 /POINTER_SIZE Qualifier Options
1-16 /PRECISION Qualifier Options
1-17 /PREFIX_LIBRARY_ENTRIES Qualifier Options
1-18 /REENTRANCY Qualifier Options
1-20 /STANDARD Qualifier Options
1-21 /WARNINGS Qualifier Options
1-22 OpenVMS Linker Default File Types for Input Files
2-1 Common RMS Run-Time Processing Functions
3-3 Status Values of SYS$SETEF
3-4 Status Values of SYS$READEF
3-7 Status Values of SYS$SETPRN
3-8 Valid Parameter-Passing Mechanisms in DEC C
3-9 Default Passing Mechanisms
3-10 OpenVMS Run-Time Library Facilities
3-12 DEC C Implementation
3-14 Facility Codes
4-1 Location, Lifetime, and the Storage-Class Keywords
4-2 Predefined Alignment Constants
4-4 Program-Section Attributes
4-5 External Models and Definitions
4-6 Combinations of Storage-Class Specifiers and Modifiers (Alpha only)
4-7 Combinations of Storage-Class Specifiers and Modifiers (VAX only)
4-8 Combination Attributes
5-1 Comparison of Mixing Different extern_models
6-1 Predefined System Identification Macros
6-2 __DECC_VER Version-Type Encodings
6-3 Standards Macros-All platforms
A-1 Trigraphs
A-3 New and Traditional Spellings of Macros
C-1 Commands to Manipulate Tokens and Placeholders
C-2 Mapping Between CDD/Repository and DEC C Data Types