Your Browser is not longer supported

Please use Google Chrome, Mozilla Firefox or Microsoft Edge to view the page correctly
Loading...

{{viewport.spaceProperty.prod}}

C/C++ program units as subroutines

UTM program units and event exits are subroutines of the UTM main routine. This has the following consequences:

  • The program name defines the start address.

  • A C/C++ program unit is defined as a function of type void.

  • All formal parameters must be declared explicitly.

  • The program unit is terminated dynamically with a PEND call; the event exits are an exception to this rule. They can be exited using the return statement. The exit statement must never be used.

A set of header files is provided for compatibility and to ensure that you are working with correct data structures. You use the same header files for C and C++ program units. The use of these header files is described in chapter "Data structures for C/C++ program units".
The include files kcca.h, kcmac.h and kcpa.h are located:

  • on BS2000 systems in the library SYSLIB.UTM.070.C

  • on Unix, Linux and Windows systems, in the include subdirectory of the UTM utmpath directory

If you cannot compile C programs because the first KDCS call parameter has the type struct kc_pa * instead of the type union kc_paa * then you should set the UTM_OLDANSI option for the C precompiler in order to prevent checking.

Program unit names

The name of a C program unit is also its start address.

This name is freely definable. It must be unique within an application program. Some names have already been reserved and for that reason may not be used.

You should observe the following points when choosing a name:

  • For BS2000 systems:

    • All names beginning with KDC, KC and I are reserved and should be avoided.

  • For Unix, Linux and Windows systems:

    • All names beginning with KDC, KC, x or ITS are reserved.

    • Names beginning with t_ are reserved for PCMX.

    • Names beginning with a_, o_ and s_ are reserved for OSS.

  • The name must conform to the C/C++ conventions.

You must also specify the program names (start address names) when generating the UTM application in the PROGRAM KDCDEF application for each name
(see the openUTM manual “Generating Applications”).