main function and extern "C" programming considerations
If a C shared object (CSO) contains an entry point that is in a C++ program, the C++ compiler mangles the function name when a CSO does not contain the main function.
Specify the extern "C" linkage specification to produce an entry point other than main. For more information about coding a program with a main function, see main function support.
The extern "C" linkage specification allows a C++ application entry point to be called through z/TPF enter/back services. This linkage specification forces the linkage to the entry point of the shared object to be C linkage instead of C++ linkage.
The entry point function must have the extern "C" linkage specification. Other functions in a C++ application do not need this linkage specification. A function in a C++ application that is called by another function in the same shared object can have C++ linkage. See z/TPF header files and C++ for more information about extern "C" linkage.
If you do not code the extern "C" linkage specification, the z/TPF offline loader provides an error message that the entry point is not found in the program.
ReadIt
in EmpClass
does not require this linkage specification.
class EmpClass
{
…
}
extern "C" void QZZ0 ();
{
double raise;
EmpClass *EmpPtr = new EmpClass[total_employees];
…
raise = EmpPtr[i].ReadIt;
…
}
double & EmpClass::ReadIt
{
return EmpClass.rate;
…
}