Event code 40 — get/release function pointer event

Purpose

The Get/Release Function Pointer event is used to obtain or release a function pointer for a function that resides in a separate load module.

Syntax

Call CEEEVnnn (40, function_code, func_pointer, entry_pointer, ceestart_ptr)
INT4        *function_code;
POINTER     *func_pointer;
POINTER     *entry_pointer;
POINTER     *ceestart_ptr;
func_code (input)
Defines if this event is a Get or Release request. The functions are defined as follows:
1
Fixed binary(31), indicating Get Function Pointer event
2
Fixed binary(31), indicating Release Function Pointer event
func_pointer (output)
For the Get Function Pointer event, contains the returned function pointer. For the Release Function Pointer event, this value contains the function pointer to release.
entry_pointer (input)
Language Environment recognizes the following func_addr style; Language Environment does not recognize any other entry styles:
  • C/370-style PPA
  • Language Environment routine entry layout
  • Language Environment-format CEESTART
  • Language Environment AWI stubs
ceestart_ptr (input)
CEESTART of the load module; the load module must be recognized by Language Environment.

Usage notes

  • All function pointers obtained must be released before deleting the load module which contains the associated functions.
  • The CEE3ADDM service must be called prior to calling this event handler, to augment the set of currently active members and to notify members that a new load module has been introduced into the enclave.
  • C and C++ are the only target languages that support the Get Function Pointer service.
  • The function pointer is returned with the high-order bit indicating the AMODE of the routine. You must provide the necessary AMODE switching code when passing control to the function pointer.
  • Event 40, function code 2 must be called to release each function pointer obtained, before deleting the load module containing the associated function.
  • If the load module contains any ILC or the loading and loaded modules are written in different languages, the load module should not be deleted.
  • A C function that is called using a pointer returned by Event 40 will have access to the writable static area, if it exists.
  • To use Event 40 to obtain a function pointer for a C function, the C function must either:
    • Be compiled with the pragma linkage(...,fetchable) directive, or
    • Have the function name specified as the entry point when the module is linked.

    In addition, C++ routines must be compiled as extern "C".

  • Event 40 cannot be used to obtain a function pointer for a C main() routine.
  • If you use Event 40 to obtain a function pointer for a C or C++ function, calling the function pointer will give control to a glue routine. This routine will perform AMODE switching, if needed, before passing control to the C/C++ routine.
  • If you use Event 40 to obtain a function pointer for a C or C++ routine that is compiled as a DLL, the routine cannot export any functions or variables.