Calling C and C++ functions from z/OS Debugger
You can perform calls to user and C library functions within z/OS® Debugger, unless your program was compiled with the FORMAT(DWARF) suboption of the DEBUG compiler option.
You can make calls to C library functions at any time. In addition,
you can use the C library variables stdin
, stdout
, stderr
, __amrc
,
and errno
in expressions including function calls.
The library function ctdli
cannot be called unless
it is referenced in a compile unit in the program, either main
or
a function linked to main
.
Calls to user functions can be made, provided z/OS Debugger is able
to locate an appropriate definition for the function within the symbol
information in the user program. These definitions are created when
the program is compiled with TEST(SYM)
for C or TEST
for C++.
- The function is a library function
- A prototype for the function exists in the current compile unit
- z/OS Debugger is
able to locate a prototype for the function in another compile unit,
or the function itself was compiled with
TEST(SYM)
for C or withTEST
for C++.
You can turn off this checking by specifying SET WARNING
OFF
.
extern "C"
For example, use this declaration if you want to debug an application
signal handler. When a condition occurs, control passes to z/OS Debugger which
then passes control to the signal handler.z/OS Debugger attempts linkage checking, and does not perform the function call if it determines there is a linkage mismatch. A linkage mismatch occurs when the target program has one linkage but the source program believes it has a different linkage.
- The evaluation order of function arguments can vary between the C and C++ program and z/OS Debugger. No discernible difference exists if the evaluation of arguments does not have side effects.
- z/OS Debugger knows about the function return value, and all the necessary conversions are performed when the return value is used in an expression.
- The functions cannot be in XPLINK applications.
- The functions must have debug information available.
Refer to the following topics for more information related to the material discussed in this topic.
- Related tasks
- Choosing TEST or DEBUG compiler suboptions for C programs
- Choosing TEST or DEBUG compiler suboptions for C++ programs
- Related references
- z/OS XL C/C++ Language Reference