Linkage to C++
In C++, external names are encoded for the link editor (BINDER).
If a combination of functions and data in C++ and some other ILCS language is being used, the encoding of external names must be suppressed. The C++ language construct for this purpose is:
extern "C"
declaration;
or
extern "C" {
declarations
}
Note that extern "C"
declarations are needed in the C++ program not only for the data and functions defined in C++, but also for those defined in the other ILCS language.
Shared file processing
Shared files must be opened both in the C/C++ section and in the other language section. Control over their processing is implemented internally via different FCBs.
Since processing of a shared file is accomplished using different FCBs, alternate reading of the file into the C section and the other language section is not possible. All characters of the file are supplied both to the C section and to the other language section.
Calling the main function
Calling a main
function is possible. MAIN must be then used as the entry address.
If there are several modules with main
functions in a library, the desired main
function can be selected by explicitly linking in the appropriate module (by using an INCLUDE statement instead of RESOLVE).
It is not possible to redirect the standard I/O files or pass parameters to the main
function.
Shared STXIT event handling
ILCS distinguishes between implicit language-specific event handling and event handling that can be enabled and disabled explicitly.
Implicit language-specific event handling is restricted to the STXIT events ERROR and PROCHK, while explicit enabling and disabling is possible for all STXIT events.
STXIT routines explicitly enabled by routines in different languages are managed in parallel, i.e. when an event occurs, the enabled routines of all languages involved are called (in the order in which they were enabled).
Implicit event handling is rendered ineffective by an explicitly enabled routine.
C/C++ has no implicit language-specific event handling. Explicit enabling and disabling is possible using the C library functions signal
and cstxit
.
Enabling event handling routines for the STXIT event classes ERROR and PROCHK causes implicit event handling by other languages to be deactivated. On exiting from the C/C++ language environment, the event handling routines for ERROR and PROCHK should therefore be explicitly disabled in order to reactivate implicit event handling by other languages.
With the C library function signal
, the routines are disabled by assigning SIG_DFL.