How a communication exit library is loaded
When the database manager is started, the communication
exit library is dynamically loaded and initialized. The library must
contain the initialization function db2commexitInit
. This function is known as the library initialization function.
- The highest version number of the function pointer structure that the database instance which starts the library can support.
- A pointer to a structure which contains pointers to all the APIs that require implementation.
- A pointer to a function that adds log messages to the db2diag log files.
- A pointer to an error message string.
- The length of the error message.
SQL_API_RC SQL_API_FN db2commexitInit
( db2int32 version,
void *commexit_fns,
db2commexitLogMessage *logMessage_fn,
char **errormsg,
db2int32 *errormsglen );
The initialization function is the only function in the library that uses a prescribed function name. The other library functions are referenced through function pointers that are returned from the initialization function.
- Cast the functions pointer to a pointer of an appropriate functions structure.
- Assign the pointers to the other functions in the library.
- Assign the version number of the function pointer structure that is returned.
The communication exit library infrastructure supports both the communication buffer exit library and the runtime communication exit library. The input version parameter contains the highest version numbers for both of these libraries. This function must use the DB2COMMEXIT_GET_BUFFER_FN_VER macro to obtain the highest supported version number of the function pointer structure for DRDA style functions. The function must also use the DB2COMMEXIT_GET_RUNTIME_FN_VER macro to obtain the highest supported version number of the function pointer structure for the runtime communication exit library functions.
To use the communication buffer exit library, this function must cast commexit_fns to db2commexitFunctions_v1. The function must also define the function pointers and call the DB2COMMEXIT_SET_BUFFER_FN_VER macro to set the version number. To use the runtime communication exit library, this function must cast commexit_fns to db2commexitRuntimeFunctions_v1. The function must also define the function pointers and call the DB2COMMEXIT_SET_RUNTIME_FN_VER macro to set the version number. Only one of the macros must be called by this function.
The function db2commexitInit
must be declared extern "C"
if the library is compiled
as C++.