Using Operational Descriptors to Pass Parameters of Unknown Data Type
- ILE Concepts
- ILE C/C++ Compiler Reference
The C++ compiler supports operational descriptors for describing
null-terminated strings. A character string in C++ is defined by: char
string_name[n], char * string_name, or string-literal.
C++ defines a string as a contiguous sequence of characters terminated by and including the first null character. In another language, a string may be defined as consisting of a length specifier and a character sequence. When passing a string from a C++ function to a function written in another language, an operational descriptor can be provided with the argument to allow the called function to determine the length and type of the string being passed.
To use operational descriptors, you specify a #pragma descriptor directive in your source to identify functions whose arguments have operational descriptors. Operational descriptors are then built by the calling procedure and passed as hidden arguments to the called procedure. For the syntax, see the ILE C/C++ Compiler Reference.
- The #pragma descriptor for
func1()with a #pragma descriptor directive for the function in a header fileoper_desc.h. See Figure 1. - An ILE C program that calls
func1(). See Figure 1. - The ILE C source code of
func1()that contains an ILE API that is used to get information from the operational descriptor. See Figure 1.