The function of the CEETHLOC stub (Figure 1) is to interface to the CEEPHTLC (XPLINK Trigger Load on Call) routine on behalf of an unresolved "by-name" function call, which will load the DLL and then invoke the function. This stub is directly referenced from the compilation unit's generated code, and is link-edited in the same program object as the compilation unit. The compiler-generated code will locate the function descriptor, load registers 5 and 6 from the start of the function descriptor, and branch to the stub address in register 6. Once inside the stub, register 7 contains the return address and register 5 contains the 'function_id' identifying this imported function (from the first word of the descriptor). Register 6 is used as a work register to load and branch to the entry point of the CEEPHTLC function.
*/********************************************************************/
*/* */
*/* CEETHLOC - Language Environment */
*/* "trigger load on XPLINK; call by name" stub */
*/* */
*/* This stub contains one entry point */
*/* + 0 for XPLINK linkage */
*/* */
*/********************************************************************/
CEETLOCE CSECT
CEETLOCE RMODE ANY
CEETLOCE AMODE ANY
*
DS 0D Doubleword aligned...
DC XL7'00C300C500C500' eyecatcher text ".C.E.E."
DC XL1'F4' eyecatcher marker "4"
*
ENTRY CEETHLOC
CEETHLOC XATTR LINKAGE(XPLINK)
CEETHLOC DS 0D Real entry pt of stub
L 6,CEECAACELV-CEECAA(,12)
L 6,CEECELVPHTLC-CEECELV(,6)
BR 6
*
CEEXCELV
CEEXCAA
END CEETLOCE
LM r5,r6,dd+0(envreg) load environment & function addresses
* ... from function descriptor
BASR r7,r6 call the function
DC X'4700'
DC Y(signed offset/8 to entry point marker)