=:The OpenVMS Frequently Asked Questions(FAQ)C

The OpenVMS Frequently Asked Questions(FAQ)



 r \ ^  
PreviousContentsIndex

}

10.23 VAX C and DEC C, and other OpenVMS C Programming Considerations?



DVAX C V3.2 was released for OpenVMS VAX systems in 1991. DEC C V4.0 Areplaced VAX C V3.2 in 1993 as the HP C compiler for OpenVMS VAX Fsystems. HP C is the ANSI C compiler for OpenVMS Alpha systems. VAX C Bpredates the ANSI C standards, and has various areas that are not Hcompliant with ANSI C requirements. HP C is an ANSI C compiler, and can Halso compile most VAX C code when /STANDARD=VAXC is specified. Versions Hof this compiler between V3.2 and V6.5 (exclusive) were known as DEC C, DIGITAL C, and Compaq C.

EBoth compilers can be installed at the same time on the same OpenVMS GVAX system, allowing a migration from VAX C to DEC C, and allowing the <same DEC C code to be used on OpenVMS VAX and OpenVMS Alpha.

FThe system manager can choose the system default C compiler when HP C Gis installed on a system with VAX C, and a C programmer can explicitly >select the required compiler for a any particular compilation.

FA current "C" license PAK allows access to both VAX C and HP C on the same OpenVMS VAX system.

HVarious HP C versions can be installed on OpenVMS VAX V5.5-2 and later. >OpenVMS VAX releases such as V5.5-2 and V6.0 will require the Einstallation of a HP C RTL kit, a kit that is included with the HP C Hcompiler. OpenVMS VAX versions V6.1 and later do not require a seperate GRTL kit, but HP C RTL ECO kits are available to resolve problems found +with the C RTL on various OpenVMS releases.

GWith HP C, for automatic resolution of the standard C library routines :by the LINKER utility, use the /PREFIX qualifier, such as E/PREFIX=ALL_ENTRIES. If a particular application program replaces an Dexisting C library routine, use /PREFIX=(ALL_ENTRIES,EXCEPT=(...)). F(VAX C required explicit specification of an RTL shareable image or C object library during the link.)

GWhen the /PREFIX is requested, the compiler generates a "decc$" prefix Gon the specified symbols. This prefix allows the LINKER to resolve the Fexternal symbols against the symbols present in the DECC$SHR library. EThe DECC$SHR library is included in the IMAGELIB.OLB shareable image Glibrary, and IMAGELIB is searched by default when any program (written Cin any language) is LINKed. Because the standard C library routine Enames are very likely to match application routines written in other Elanguages, a prefix "decc$" is added to the C symbol names to assure Btheir uniqueness; to prevent symbol naming conflicts. C programs, Hhowever, can sometimes have private libraries for various purposes, and Dthe external routines share the same names as the library routines. E(This is not recommended, but there are applications around that use Gthis technique.) Thus the need to explicity specify whether or not the G"decc$" prefix should be prepended to the external symbol names by the compiler.

HThe qualifiers, and most (all?) with associated pragmas, that may be of 3interest when migrating VAX C code to HP C include:



HPermit structure members to be naturally aligned whenever possible, and ?avoid using /NOMEMBER_ALIGNMENT. If you need to disable member @alignment, use the equivilent #pragma to designate the specific Hstructures. The alignment of structure members normally only comes into Fplay with specific unaligned data structures---such as the sys$creprc Gquota itemlist---and with data structures that are using data that was ?organized by a system using byte or other non-member alignment.

DVersions of HP C such as V6.0 include the capability to extract the Ccontents of the standard header libraries into directories such as FSYS$SYSROOT:[DECC$LIB...], and provide various logical names that can Cbe defined to control library searches. With HP C versions such as GV6.0, the default operations of the compiler match the expectations of ?most OpenVMS programmers, without requiring any definitions of Esite-specific library-related logical names. (And logical names left Dfrom older DEC C versions can sometimes cause the compiler troubles locating header files.)

HHP C V5.6 and later include a backport library, a mechanism by which HP AC running on older OpenVMS releases can gain access to newer RTL Hroutines added to the RTL in later OpenVMS releases---the language RTLs 5ship with OpenVMS itself, and not with the compilers.

EExample C code is available in SYS$EXAMPLES:, in DECW$EXAMPLES (when Gthe DECwindows examples are installed), in TCPIP$SERVICES (or on older Freleases, UCX$EXAMPLES) when HP TCP/IP Services is installed), on the *Freeware CD-ROMs, and at web sites such as



WFor additional information, please see Section 3.9.B

10.23.0.0.0.1 Other common C issues


BThe localtime() function and various other functions maintain the Hnumber of years since 1900 in the "struct tm" structure member tm_year. GThis field will contain a value of 100 in the year 2000, 101 for 2001, Aetc., and the yearly incrementation of this field is expected to continue.

GThe C epoch typically uses a longword (known as time_t) to contain the Gnumber of seconds since midnight on 1-Jan-1970. At the current rate of Dconsumption of seconds, this longword is expected to overflow (when Ginterpreted as a signed longword) circa 03:14:07 on 19-Jan-2038 (GMT), Eas this time is circa 0x7FFFFFFF seconds since the C base date. (The >most common solution is to ensure that time_t is an unsigned.)

EIf C does not correctly handle the display of the local system time, Fthen check the UTC configuration on OpenVMS---the most common symptom Fof this is a skew of one hour (or whatever the local daylight savings Htime change might be). This skew can be caused by incorrect handling of Dthe "is_dst" setting in the application program, or by an incorrect <OpenVMS UTC configuration on the local system. (See section 1Section 4.4.)

GWhen sharing variables with other languages, here is some example HP C code...

 

"
      ...        #pragma extern_model save )      #pragma extern_model strict_refdef "      extern int   VMS$GL_FLAVOR; #      #pragma extern_model restore 
      ... 




1and here is some associated example Bliss code...

 

"
      ...       EXTERNAL          VMS$GL_FLAVOR,       .... 


E

10.23.0.0.0.2 Other common C++ issues


EHP C++ (a separate compiler from HP C) provides both symbol mangling Band symbol decoration. Some of the details of working with longer Fsymbol names and the resulting symbol name mangling in mixed language Henvironments are listed in the shareable image cookbook, and in the C++ Adocumentation. Symbol name decoration permits the overloading of Hfunctions (by adding characters to the external symbol for the function Ato indicate the function return type and the argument data types Hinvolved), and mixed-language external references can and often do need Dto disable this decoration via the extern "C" declaration mechanism:

 

"
      extern "C" 
        { )        extern int ExternSymbol(void *); .        extern int OtherExternSymbol(void *); 
        } 




bAlso see Section 14.13 for information on /ARCHITECTURE and /OPTIMIZE=TUNE.

nSee Section 10.16 for information on the C system and the lib$spawn call in CAPTIVE environments.

EConstructs such as the order of incrementation or decrementation and Athe order of argument processing within an argument list are all Dimplementation-defined. This means that C coding constructs such as:

 

"
    i = i++;     a[i] = i++;     foo( i, i++, --i); 




Eare undefined and can have (adverse) implications when porting the C Ccode to another C compiler or to another platform. In general, any Hcombination of ++, --, =, +=, -=, *=, etc operators that will cause the Fsame value to be modified multiple times (between what the ANSI/ISO C 8standard calls "sequence points") produce undefined and implementation-specific results.

FWithin C, the following are the "sequence points": the ";" at the end Dof a C statment, the ||, &&, ?:, and comma operators, and a Fcall to a function. Note specifically that = is NOT a sequence point, Gand that the individual arguments contained within a function argument Hlist can be processed from right to left, from left to right, or at any random whim.

AHP C for OpenVMS VAX (formerly DEC C) and VAX C do differ in the related processing.

DSo you are looking for OpenVMS-specific definitions (include files)?

FUCBDEF.H, PCBDEF.H and other OpenVMS-specific definitions---these are Dconsidered part of OpenVMS and not part of the C compiler kit---are /available on all recent OpenVMS Alpha releases.

2To reference the version-dependent symbol library Dsys$share:sys$lib_c.tlb, use a command similar to the following for compilation:

 

"
'$ CC sourcea+SYS$LIBRARY:SYS$LIB_C/LIB 




?You can also define DECC$TEXT_LIBRARY to reference the library.

=You will want to review the Programming Concepts manual, and -specifically take a quick look at Chapter 21.

CAnd some general background: the STARLET definitions (and thus the Hsys$starlet_c.tlb library) contain the symbols and the definitions that Fare independent of the OpenVMS version. The LIB definitions (and thus Hsys$lib_c) contain symbols and definitions that can be dependent on the FOpenVMS version. You won't need to rebuild your code after an OpenVMS Gupgrade if you have included definitions from STARLET. The same cannot Gbe said for some of the definitions in LIB---you might need to rebuild Byour code. (The UCB structure can and has changed from release to release, for instance.)

FRecent versions of C automatically search sys$starlet_c.tlb. Explicit +specification of sys$lib_c.tlb is required.

FAlso see the Ask The Wizard website topics (2486), (3803), and (1661):



WFor additional information, please see Section 3.9.

iSee Section 9.5 for information on the C off_t limitations, resolved Cin OpenVMS V7.3-1 and later and in ECO kits available for specific <OpenVMS releases. The use of a longword for off_t restricts Happlications using native C I/O to file sizes of two gigabytes or less, Dor these applications must use native RMS or XQP calls for specific operations.j

10.24 Status of Programming Tools on OpenVMS VAX?



HDECthreads V7.3 and the HP C compiler (also known as Compaq C and DEC C)@V6.4 are presently expected to be the last updates and the last Creleases of these development packages for use on OpenVMS VAX. The Erun-time support for both DECthreads (CMA$RTL) and for C (DECC$CRTL) will continue to beHmaintained, and will continue to be available on OpenVMS VAX. The VAX C GV3.2 compiler is the final VAX C compiler release for OpenVMS VAX, and Hthe VAX C Run-Time Library (VAXCRTL) will also continue to be available.

GNew development and new features and product enhancements continue for Cthe OpenVMS Alpha and the OpenVMS IA-64 DECthreads and C compilers.


>

Chapter 11
DECwindows


z

11.1 How do I let someone else display something on my workstation?



FOn a workstation, you will want to use the "Customize" menu Eof the session manager utility and select "Security". When Dthe pop-up box appears, you can select the host node, username, and Gtranport that will allow you to launch an application that targets the workstation display.

DIf this does not provide you with access to the display, You need a checklist of sorts:

m

11.2 How do I create a display on another workstation?



HTo create a display from an OpenVMS host to a remote X Windows display, &use one of the following DCL commands:

 

"
A$ SET DISPLAY /CREATE /TRANSPORT=net_transport /NODE=remote_node 7$ SET DISPLAY /CREATE /TRANSPORT=LAT /NODE=remote_node :$ SET DISPLAY /CREATE /TRANSPORT=DECnet /NODE=remote_node 9$ SET DISPLAY /CREATE /TRANSPORT=TCPIP /NODE=remote_node 




BNote that LAT is typically used only for the VXT series X Windows Fterminals, but it can also be used from OpenVMS to OpenVMS systems on Gvarious OpenVMS releases, such as on OpenVMS Alpha V6.1 and later. For ddetails on configuring the TCP/IP transport, see Section 11.15.

?If you are interested in X Windows terminals and have an older FVAXstation system around, please see the EWS package on Freeware V5.0.z

11.3 How can I get the information from SHOW DISPLAY into a symbol?



AUse the undocumented SHOW DISPLAY/SYMBOL, and then reference the Dsymbols DECW$DISPLAY_NODE, DECW$DISPLAY_SCREEN, DECW$DISPLAY_SERVER and/or DECW$DISPLAY_TRANSPORT.

EAn example of calling the underlying (and also undocumented) sys$qio ?programming interface for the WSDRIVER (WSAn:) is available at:

 

"
Hhttp://www.openvms.compaq.com/freeware/srh_examples/DECUS_UNDOC_CLINIC/ 


d

11.4 How do I get a log of a DECterm session?



FIf you are working from a Decterm, you can use the AutoPrint feature. CChoose the "Printer..." menu item from the "Options" menu, set the Eprinting destination to the name of the file you want, and set "Auto *Print Mode". You are now free to continue.

GIt should be noted that all of the characters and escape sequences are Gcaptured, but if you display the resulting log file on a DECterm, then 3you will see exactly what was originally displayed.w

11.5 Why does the DELETE key delete forward instead of backward?



GThis involves the Motif virtual key bindings. When a Motif application >starts, it looks at the vendor string returned in the display Fconnection information and attempts to match the string to a table of virtual bindings.

GYou can override the default bindings in your decw$xdefaults.dat file. AHere is the entry you would make to get the default VMS bindings.

 

"
*defaultVirtualBindings:\" osfCancel :  []F11 \n\! osfLeft :  []Left \n\ osfUp  :  []Up  \n\# osfRight :  []Right \n\! osfDown :  []Down \n\( osfEndLine :Alt  []Right \n\) osfBeginLine :Alt  []Left \n\$ osfPageUp :  []Prior \n\% osfPageDown :  []Next \n\* osfDelete :Shift  []Delete \n\& osfUndo :Alt  []Delete \n\( osfBackSpace :  []Delete \n\( osfAddMode :Shift  []F8  \n\! osfHelp :  []Help \n\  osfMenu :  []F4  \n\# osfMenuBar :  []F10 \n\% osfSelect :  []Select \n\) osfActivate :  []KP_Enter \n\) osfCopy :Shift  []DRemove \n\$ osfCut  :  []DRemove \n\! osfPaste :  []Insert 




To merge:

 

"
 $ xrdb :== $decw$utils:xrdb.exe ($ xrdb -nocpp -merge decw$xdefaults.dat 




EAlso note that the DECW$UTILS:DECW$DEFINE_UTILS.COM procedure can be -used to establish the xrdb and other symbols.

@Also see the DECxterm directory of Freeware V5.0 for details on 2connecting to OpenVMS from various UNIX platforms.a

11.6 Why is DECwindows Motif not starting?



GFirst check to see if there is a graphics device, usually a G* device. H(eg: On a DEC 2000 model 300, use the command SHOW DEVICE GQ) If you do not find a graphics device:



)If there is a G* graphics device present:






 r Y \ ^  
PreviousNextContentsIndex