Document revision date: 15 July 2002
[Compaq] [Go to the documentation home page] [How to order documentation] [Help on this site] [How to contact us]
[OpenVMS documentation]

Compaq C
Run-Time Library Reference Manual for OpenVMS Systems


Previous Contents Index

32-Bit User and Group Identifiers

The C RTL supports 32-bit User Identification (UID) and Group Identification (GID). 32-bit UID and GID support was added to some versions of the OpenVMS operating system to provide support for POSIX style identifiers (IDs). Currently, POSIX style IDs are supported only by some OpenVMS versions done for specific government agencies, but will be integrated into future OpenVMS releases.

Although OpenVMS 7.3-1 does not support POSIX style IDs, it does support 32-bit UID and GID. When an application is compiled to use 32-bit UID/GID, the UID and GID are derived from the UIC as in previous versions of the operating system. In some cases, such as with the getgroups function, more information may be returned when the application supports 32-bit GIDs.

To compile an application for 32-bit UID/GID support, define the macro __USE_LONG_GID_T. To compile an application for 16-bit UID/GID support, define the macro _DECC_SHORT_GID_T.

In addition, although you cannot compile with POSIX style IDs enabled on OpenVMS Version 7.3-1, you can run programs that were compiled with POSIX style IDs enabled on OpenVMS systems that do provide that support.

New Functions

The Compaq C RTL includes the following new or modified functions for OpenVMS Version 7.3-1:


New feature-switch-setting functions:
 
   decc$feature_get_index 
   decc$feature_get_name 
   decc$feature_get_value 
   decc$feature_set_value 
 
New scanf functions:
 
   vfscanf       vfwscanf 
   vscanf        vwscanf 
   vsscanf       vswscanf 
 
New functions to support 64-bit file sizes & offsets:
 
   fseeko        ftello 
 
Functions modified to support 64-bit file sizes & offsets:
 
  fstat          mmap  
  ftruncate      stat 
  ftw            truncate 
  lseek           

New and Changed Features - Compaq C Version 6.4

The following C RTL enhancements were included in Compaq C Version 6.4 and OpenVMS Version 7.3:

The strptime function was made XPG5-compliant

The strptime function has been modified to be compliant with X/Open CAE Specification System Interfaces and Headers Issue 5 (commonly known as XPG5). The change for XPG5 is in how the strptime function processes the %y directive for a two-digit year within the century if no century is specified.

When a century is not otherwise specified, XPG5 requires that values for the %y directive in the range 69-99 refer to years in the twentieth century (1969 to 1999 inclusive), while values in the range 00-68 refer to years in the twenty-first century (2000 to 2068 inclusive). Essentially, for the %y directive, strptime became a "pivoting" function, with 69 being a pivoting year.

Before this change, the strptime function interpreted a two-digit year with no century as a year within twentieth century.

With OpenVMS Version 7.3, XPG5-compliant strptime becomes a default strptime function in the Compaq C RTL. However, the previous nonpivoting XPG4-compliant strptime function is retained for compatibility.

The pivoting is controlled by the DECC$XPG4_STRPTIME logical name. To use the nonpivoting version of strptime , either:

The limitation of Eight Nested Directory Levels was Lifted (ALPHA ONLY)

The Compaq C RTL I/O subsystem was enhanced to remove the restriction of eight nested directory levels for an ODS-5 device. This affects Compaq C RTL functions such as access , mkdir , opendir , rmdir , and stat .

Improved Support for Extended File Specifications (ALPHA ONLY)

The following sections describe improved Compaq C RTL support for extended file specifications.

The Compaq C RTL supports case preservation in file names (ALPHA ONLY)

Programs linked against the Compaq C run-time library DECC$SHR can now preserve the case of file names on ODS level 5 disks. This applies when creating or reporting file names. By default, this feature is disabled. To enable this feature enter the following command:


$ DEFINE DECC$EFS_CASE_PRESERVE ENABLE 

The following related feature logical name can also be enabled:


$ DEFINE DECC$EFS_CASE_SPECIAL ENABLE 

With DECC$EFS_CASE_SPECIAL enabled:

The commands to disable the preceding logical-name settings are:


$ DEFINE DECC$EFS_CASE_PRESERVE DISABLE 
$ DEFINE DECC$EFS_CASE_SPECIAL DISABLE 

When enabled, DECC$EFS_CASE_SPECIAL overrides the value of DECC$EFS_CASE_PRESERVE.

The DECC$EFS_CASE_PRESERVE and DECC$EFS_CASE_SPECIAL logicals are checked only once per image activation, not on a file-by-file basis.

Most C RTL functions now accept long OpenVMS style file names as arguments (ALPHA ONLY)

For OpenVMS Alpha Version 7.2, some basic Compaq C RTL I/O functions ( creat , stat , and the functions from the open family of functions) were enhanced to accept long OpenVMS style file names for an ODS-5 device.

For OpenVMS Alpha Version 7.3, all other Compaq C RTL functions, except chdir and the functions from the exec family of functions, were also enhanced to accept long OpenVMS style file names for an ODS-5 device.

All C RTL functions that accept or report full file specifications will process file specifications up to 4095 bytes long, subject to the rules defined for the media format. For file specifications in OpenVMS format, there are no special restrictions. In situations where a full file specification cannot be reported because the buffer is too short, the function attempts to report the abbreviated name.

UNIX file names have the following restrictions:

The Compaq C RTL Supports Exact-Case argv Arguments (ALPHA ONLY)

Nonquoted command-line arguments passed to C and C++ programs (argv arguments) can now optionally have their case preserved, rather than being lowercased as in previous versions.

By default, this feature is disabled.

To enable this case preservation feature, define the logical name DECC$ARGV_PARSE_STYLE to "ENABLE" and set the process-level DCL parse style flag to "EXTENDED" in the process running the program:


$ DEFINE DECC$ARGV_PARSE_STYLE ENABLE 
$ SET PROCESS/PARSE_STYLE=EXTENDED 

Enabling this feature also ensures that the image name returned in argv[0] is also case-preserved.

To disable this feature, use any one of the following commands:


 $ SET PROCESS/PARSE_STYLE=TRADITIONAL 

or


$ DEFINE/SYSTEM DECC$ARGV_PARSE_STYLE DISABLE 

or


$ DEASSIGN DECC$ARGV_PARSE_STYLE 

The value of the DECC$ARGV_PARSE_STYLE logical is case-insensitive.

The Compaq C RTL Can Implicitly Open Files for Shared Access

The Compaq C RTL was enhanced to open all files for shared access as if the "shr=del,get,put,upd" option was specified in the open* or creat call.

To enable this feature, define the logical name DECC$FILE_SHARING to "ENABLE". The value is case-insensitive.

DECC$FILE_SHARING is checked only once per image activation, not on a file-by-file basis.

Alternative Way of Translating UNIX File Specs

The Compaq C RTL was enhanced to allow interpreting the leading part of a UNIX style file spec as either a subdirectory name or a device name.

As with previous releases, the default translation of foo/bar (UNIX style name) is FOO:BAR (OpenVMS style device name).

To request translation of foo/bar (UNIX style name) to [.FOO]BAR (OpenVMS style subdirectory name), define the logical name DECC$DISABLE_TO_VMS_LOGNAME_TRANSLATION to any value. DECC$DISABLE_TO_VMS_LOGNAME_TRANSLATION is checked only once per image activation, not on a file-by-file basis.

New Functions

The Compaq C RTL has added the following functions in OpenVMS Version 7.3:


fchown            
link 
utime 
utimes 
writev 


Chapter 1
Introduction

The ISO/ANSI C standard defines a library of functions, as well as related types and macros, to be provided with any implementation of ANSI C. The Compaq C Language Reference Manual describes the ANSI-conformant library features common to all Compaq C platforms. The Compaq C Run-Time Library Reference Manual for OpenVMS Systems provides a more detailed description of these routines and their use in the OpenVMS environment. It also documents additional header files, functions, types, and macros that are available on the OpenVMS system.

All library functions are declared in a header file. To make the contents of a header file available to your program, include the header file with an #include preprocessor directive. For example:


#include <stdlib.h> 

Each header file contains function prototypes for a set of related functions, and defines any types and macros needed for their use.

To list the header files on OpenVMS Alpha systems, use the following commands:


$ LIBRARY/LIST ALPHA$LIBRARY:SYS$STARLET_C.TLB 
 
$ LIBRARY/LIST ALPHA$LIBRARY:DECC$RTLDEF.TLB 
 
$ DIR SYS$COMMON:[DECC$LIB.REFERENCE.DECC$RTLDEF]*.H; 
 
$ DIR ALPHA$LIBRARY:*.H; 

The first command lists the text module form of the header files for the OpenVMS system interfaces. The second lists the text module form of the header files for the Compaq C language interface. The third lists *.H header files for the Compaq C language interfaces. The fourth lists *.H header files for layered products and other applications.

Note

The SYS$COMMON:[DECC$LIB.REFERENCE.DECC$RTLDEF] directory is only a reference area for your viewing. The compiler still looks in the *.TLB files for #include file searches.

To list the header files on OpenVMS VAX systems, use one of the following commands:


$ DIR 'F$TRNLMN("DECC$LIBRARY_INCLUDE")'*.H;
$ DIR DECC$LIBRARY_INCLUDE:*.H;

On OpenVMS VAX systems, the following command might also find additional or duplicate header files:


$ DIR SYS$LIBRARY:*.H;

However, duplicate files (such as <stdio.h> ) found in SYS$LIBRARY probably support the VAX C Version 3.2 environment and should not be used with Compaq C.

Function definitions themselves are not included in the header files, but are contained in the Compaq C Run-Time Library (RTL) shipped with the OpenVMS operating system. Before using the Compaq C RTL, you must be familiar with the following topics:

A knowledge of all these topics is necessary to effectively use the Compaq C RTL. This chapter shows the connections between these topics and the Compaq C RTL. Read this chapter before any of the other chapters in this manual.

The primary purpose of the Compaq C RTL is to provide a means for C programs to perform I/O operations; the C language itself has no facilities for reading and writing information. In addition to I/O support, the Compaq C RTL also provides a means to perform many other tasks.

Chapters 2 through 11 describe the various tasks supported by the Compaq C RTL. The Reference Section alphabetically lists and describes all the functions and macros available to perform these tasks.

1.1 Using the Compaq C Run-Time Library

When working with the Compaq C RTL, you must be aware of some implementation specifics.

First, if you plan to use Compaq C RTL functions in your C programs, make sure that a function named main or a function that uses the main_program option exists in your program. For more information, see the Compaq C Language Reference Manual or the Compaq C User's Guide for OpenVMS Systems.

Second, the Compaq C RTL functions are executed at run time, but references to these functions are resolved at link time. When you link your program, the OpenVMS Linker resolves all references to Compaq C RTL functions by searching any shareable code libraries or object code libraries specified on the LINK command line.

You can use the Compaq C RTL as a shareable image or you can use the Compaq C RTL object libraries.

When you use the Compaq C RTL as a shareable image, the code for the RTL resides in an image file in SYS$SHARE and is shared by all Compaq C programs. After execution, control returns to your program. This process has a number of advantages:

When linking to the Compaq C RTL, you do not need to define any LNK$LIBRARY logicals. In fact, you should deassign LNK$LIBRARY because linking with the shareable image is more convenient than linking with the Compaq C RTL object libraries.

See your OpenVMS, Compaq C, or Compaq C++ release notes for any supplemental information about linking with the Compaq C RTL.

1.2 RTL Linking Options on Alpha Systems (ALPHA ONLY)

The following sections describe several ways of linking Compaq C and Compaq C++ programs with the Compaq C RTL on OpenVMS Alpha systems.

1.2.1 Linking with the Shareable Image

Most linking needs should be satisfied by using the Compaq C RTL shareable image DECC$SHR.EXE in the ALPHA$LIBRARY directory.

The shareable images VAXCRTL.EXE and VAXCRTLG.EXE do not exist on OpenVMS Alpha systems. The only C RTL shareable image is ALPHA$LIBRARY:DECC$SHR.EXE, which the linker automatically finds through IMAGELIB.OLB.

The fact that VAXCRTL*.EXE does not exist on Alpha systems has the following ramifications:

To link against the shareable image, use the LINK command. For example:


$ LINK PROG1

The linker automatically searches IMAGELIB.OLB to find DECC$SHR.EXE, and resolves all C RTL references.

1.2.2 Linking with the Object Libraries

The Compaq C RTL object libraries are used solely for linking programs compiled without /PREFIX=ALL.

On OpenVMS Alpha systems, the Compaq C RTL provides the following object libraries in the ALPHA$LIBRARY directory:

The object library VAXCCURSE.OLB, which provides access to the Curses functions, contains unprefixed entry points that vector to the appropriate prefixed entry points.

The object libraries VAXCRTL.OLB, VAXCRTLD.OLB, VAXCRTLT.OLB, VAXCRTLX.OLB, VAXCRTLDX.OLB, and VAXCRTLTX.OLB also contain unprefixed entry points that vector to the appropriate prefixed entry points, depending on the floating-point type specified by the object library used:

/L_DOUBLE_SIZE=128 is the default.

On the LINK command, specify only one of the VAXCRTL*.OLB libraries and, if needed, the VAXCCURSE.OLB library.

In the default mode of the compiler (/STANDARD=RELAXED_ANSI89) and also in strict ANSI C mode, all calls to ANSI C standard library routines are automatically prefixed with DECC$. With the /[NO]PREFIX_LIBRARY_ENTRIES qualifier, you can change this to prefix all Compaq C RTL names with DECC$, or to not prefix any Compaq C RTL names. Other options are also available for this qualifer. See the /[NO]PREFIX_LIBRARY_ENTRIES qualifier in this chapter for more information.

When linking with /NOSYSSHR, if calls to the Compaq C RTL routines are prefixed with DECC$, then the modules in STARLET.OLB are the only ones you need to link against. Since STARLET.OLB is automatically searched by the linker (unless the link qualifier /NOSYSLIB is used), all prefixed RTL external names are automatically resolved.

If any calls to the Compaq C RTL routines are not prefixed, then you need to explicitly link against VAXCRTL.OLB, VAXCRTLD.OLB, VAXCRTLT.OLB (or VAXCRTLX.OLB, VAXCRTLDX.OLB, or VAXCRTLDX.OLB), or VAXCCURSE.OLB, depending on which floating-point types you need, or if you want Curses functions. If you are linking with /NOSYSSHR, prefixed Compaq C RTL entry points are resolved in STARLET.OLB. If you are linking with /SYSSHR (the default), prefixed Compaq C RTL entry points are resolved in DECC$SHR.EXE.

1.2.3 Examples

The following examples show several different ways you might want to link with the Compaq C RTL. See Figure 1-1 for a graphical summary of these examples.

  1. Most of the time, you just want to link against the shareable image:


    $ CC/PREFIX_LIBRARY_ENTRIES=ALL_ENTRIES PROG1
    $ LINK PROG1
    

    The linker automatically searches IMAGELIB.OLB to find DECC$SHR.EXE.

  2. If you want to use just object libraries (to write privileged code or for ease of distribution, for example), use the /NOSYSSHR qualifier of the LINK command:


    $ CC/PREFIX_LIBRARY_ENTRIES=ALL_ENTRIES PROG1
    $ LINK/NOSYSSHR PROG1
    

    Prefixed RTL symbol references in the user program are resolved in the Compaq C RTL object library contained in STARLET.OLB.

    Notes

    • When linking Compaq C programs against the Compaq C RTL object libraries using the /NOSYSSHR qualifier, applications that previously linked without undefined globals may result in undefined globals for the CMA$TIS symbols. To resolve these undefined globals, add the following line to your link options file:


      SYS$LIBRARY:STARLET.OLB/LIBRARY/INCLUDE=CMA$TIS 
      

    • If a program linked with the /NOSYSSHR qualifier makes a call to a routine that resides in a dynamically activated image, and the routine returns a value indicating an unsuccessful status, errno is set to ENOSYS, and vaxc$errno is set to C$_NOSYSSHR. The error message corresponding to C$_NOSYSSHR is "Linking /NOSYSSHR disables dynamic image activation." An example of this situation is a program linked with /NOSYSSHR that makes a call to a socket routine.
  3. When compiling with prefixing disabled, in order to use object libraries that provide alternate implementations of C RTL functions, you need to use the VAXC*.OLB object libraries. In this case, compile and link as follows:


    $ CC/NOPREFIX_LIBRARY_ENTRIES PROG1
    $ LINK PROG1, MYLIB/LIBRARY, ALPHA$LIBRARY:VAXCRTLX.OLB/LIBRARY
    

    Unprefixed Compaq C RTL symbol references in the user program are resolved in MYLIB and in VAXCRTL.OLB.
    Prefixed Compaq C RTL symbol references in VAXCRTLX.OLB are resolved in DECC$SHR.EXE through IMAGELIB.OLB.
    In this same example, to get IEEE T-floating double-precision floating-point support, you might use the following compile and link commands:


    $ CC/NOPREFIX_LIBRARY_ENTRIES/FLOAT=IEEE_FLOAT PROG1
    $ LINK PROG1, MYLIB/LIBRARY, ALPHA$LIBRARY:VAXCRTLTX.OLB/LIBRARY 
    

  4. Combining examples 2 and 3, you might want to use just the object libraries (for writing privileged code or for ease of distribution) and use an object library that provides C RTL functions. In this case, compile and link as follows:


    $ CC/NOPREFIX_LIBRARY_ENTRIES PROG1
    $ LINK/NOSYSSHR PROG1, MYLIB/LIBRARY, ALPHA$LIBRARY:VAXCRTLX.OLB/LIBRARY
    

    Prefixed Compaq C RTL symbol references in VAXCRTL.OLB are resolved in STARLET.OLB.

Figure 1-1 Linking with the Compaq C RTL on OpenVMS Alpha Systems



Previous Next Contents Index

  [Go to the documentation home page] [How to order documentation] [Help on this site] [How to contact us]  
  privacy and legal statement  
5763PRO_001.HTML