The OpenVMS Frequently Asked Questions(FAQ)


Previous Contents Index

10.22.1 Other common C issues

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

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

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

Floating point is prohibited in OpenVMS Alpha inner-mode (privileged) code, and in any process or other execution context that does not have floating point enabled. C programmers developing and working with OpenVMS Alpha high-IPL kernel-mode code such as device drivers will want to become familiar with the floating point processing available in the environment, and with the C compiler qualifier /INSTRUCTION_SET=[NO]FLOATING_POINT. Device drivers and other similar kernel-mode C code must be compiled with /INSTRUCTION_SET=FLOATING_POINT and /EXTERN_MODEL=STRICT_REFDEF.

Additionally, the SYS$LIBRARY:SYS$LIB_C.TLB/LIBRARY parameter will be needed to be appended to the module specification or declared via the C compiler's include library logical name mechanism when the C compiler is resolving kernel-mode data structures and definitions. This library contains OpenVMS kernel-mode and other system declaractions, and particularly a mixture of undocumented definitions and declarations, and particularly definitions and declarations that are subject to change (and that can accordingly lead to requirements for the recompilation of application code).

When 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 
      ... 

and here is some associated example Bliss code...


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

10.22.2 Other common C++ issues

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


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

Also see Section 14.7 for information on /ARCHITECTURE and /OPTIMIZE=TUNE.

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

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


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

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

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

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

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

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

To reference the version-dependent symbol library sys$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.

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

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

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

For additional information on the OpenVMS Ask The Wizard (ATW) area and for a pointer to the available ATW Wizard.zip archive, please see Section 3.9.

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

10.23 Status of Programming Tools on OpenVMS VAX?

DECthreads 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 releases of these development packages for use on OpenVMS VAX. The run-time support for both DECthreads (CMA$RTL) and for C (DECC$CRTL) will continue to be maintained, and will continue to be available on OpenVMS VAX. The VAX C V3.2 compiler is the final VAX C compiler release for OpenVMS VAX, and the VAX C Run-Time Library (VAXCRTL) will also continue to be available.

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


Chapter 11
DECwindows

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

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

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

11.2 How do I create a display on another workstation?

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


$ SET DISPLAY /CREATE /TRANSPORT=net_transport /NODE=remote_node 
$ SET DISPLAY /CREATE /TRANSPORT=LAT /NODE=remote_node 
$ SET DISPLAY /CREATE /TRANSPORT=DECnet /NODE=remote_node 
$ SET DISPLAY /CREATE /TRANSPORT=TCPIP /NODE=remote_node 

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

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

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

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

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


http://www.hp.com/go/openvms/freeware/ 
Look in the Freeware V4.0 directory /srh_examples/DECUS_UNDOC_CLINIC/.

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

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

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

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

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

You can override the default bindings in your decw$xdefaults.dat file. Here 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 

Also 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 connecting to OpenVMS from various UNIX platforms.

11.6 Why is DECwindows Motif not starting?

First check to see if there is a graphics device, usually a G* device. (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:

11.7 How do I set the title on a DECterm window?

If you are creating a new DECterm window, check


$ HELP CREATE /TERMINAL /WINDOW_ATTRIBUTES 

If you want to change the title of an existing window, use the following control sequences, where [esc] is the ANSI escape code, value decimal 27, and "text label" is what you want to display:

To set the DECterm title, send:


[esc]]21;text label[esc]\

To set the icon label, send:


[esc]]2L;text label[esc]\

To set both the DECterm title and icon to the full device name:


$  esc[0,7] = 27 
$  fulldevnam = F$Edit(F$GetDVI("TT","FULLDEVNAM"),"UPCASE,COLLAPSE") 
$  write sys$output esc+ "]21;" + fulldevnam + esc + "\" 
$  write sys$output esc+ "]2L;" + fulldevnam + esc + "\" 

You can also change the title and the icon using the Options-Window... menu.

Also see Section 12.1 and Section 8.11.

11.8 How do I customize DECwindows, including the login screen?

To customize various DECwindows Motif characteristics including the defaults used by the SET DISPLAY command, the DECwindows login screen background logo used (the default is the DIGITAL, Compaq, or HP logo), various keymaps, the FileView defaults, session manager defaults, the DECwindows login processing, DECwindows log file processing, and various other DECwindows attributes, see the example file:


$ SYS$STARTUP:DECW$PRIVATE_APPS_SETUP.TEMPLATE 

This example template file is typically copied over to the filename SYS$COMMON:[SYS$STARTUP]DECW$PRIVATE_APPS_SETUP.COM and then modified to meet site-specific requirements.

Additionally, various X tools such as xsetroot, bitmap and xrdb---some these can be useful in customizing the appearance of an application or of the DECwindows Motif display---are provided in the DECW$UTILS: area.

When using DECwindows V1.2-4 and later on OpenVMS Alpha, the default desktop is the Common Desktop Environment (CDE). You can select your preferred desktop (CDE or DECwindows Motif) when logging in, or you can change the default to the DECwindows Motif desktop using the DCL symbol decw$start_new_desktop in the DECwindows private application setup command procedure. See SYS$STARTUP:DECW$PRIVATE_APPS_SETUP.TEMPLATE for further details, and how to create DECW$PRIVATE_APPS_SETUP.COM.

Note that with DECwindows CDE, the root window is no longer visible by default. The root window is hidden behind the "backdrop" window of the current CDE workspace. To make the root window visible, use the CDE style manager selection "backdrop none", and use information such as that in the OpenVMS FAQ to set the root window.

To add a new backdrop to the DECwindows CDE environment, the backdrop must first be in or be converted into X11 pixmap format. (This conversion is often possible using tools such as xv.) Then (if necessary) create the default backdrop directory SYS$COMMON:[CDE$DEFAULTS.USER.BACKDROPS]. Place the X11 pixmap file containing the desired image into the backdrops directory, ensure that it has a filename extension of .PM. (The xv default filename extension for the X11 pixmap file is .XPM, while CDE expects only to see files with .PM.) Now invoke the CDE style manager and select a new backdrop. You will find your image will be placed at the end of the list of backdrops available.


Previous Next Contents Index