_rmem_term -- Terminate Memory Functions for Subsystem DLL

Format

int _rmem_term(void);
/* no header file - defined in runtime startup code */

Language Level: Extension
_rmem_term terminates the memory functions for subsystem DLLs. It is only needed for DLLs where the runtime library is statically linked.

By default, all DLLs call the IBM C and C++ Compilers _DLL_InitTerm function, which in turn calls _rmem_term for you. However, if you are writing your own _DLL_InitTerm function (for example, to perform actions other than memory initialization and termination), and your DLL statically links to the C runtime libraries, you need to call _rmem_term from your subsystem _DLL_InitTerm function. (For DLLs with a runtime environment, this termination is done by _CRT_term.)

If your DLL contains C++ code, you must also call __ctordtorTerm before you call _rmem_term to ensure that static constructors and destructors are terminated correctly. __ctordtorTerm is defined in the runtime startup code as:

void __ctordtorTerm(void);

Once you have called _rmem_term, you cannot call any other library functions.

If your DLL is dynamically linked, you cannot call library functions in the termination section of your _DLL_InitTerm function.

Return Value
_rmem_term returns 0 if the memory functions were successfully terminated. A return value of -1 indicates an error.

Example



_CRT_init -- Initialize DLL Runtime Environment
_CRT_term -- Terminate DLL Runtime Environment
_DLL_InitTerm -- Initialize and Terminate DLL Environment
_rmem_init -- Initialize Memory Functions for Subsystem DLL
/Ge compiler option