Format
int _tmem_term(void); /* no header file - defined in runtime startup code */
Language Level: Extension
_tmem_term terminates the tiled memory functions for subsystem
DLLs. It is only needed for DLLs that used tiled memory and that
statically link to the runtime library.
By default, all DLLs call the IBM C and C++ Compilers _DLL_InitTerm function, which in turn calls the termination functions 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 subsystem DLL does not use tiled memory, call _rmem_term instead of _tmem_term.)
If your DLL contains C++ code, you must also call __ctordtorTerm before you call _tmem_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 _tmem_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.
If your termination routine requires calling library functions, you must register the termination routine with DosExitList. Note that all DosExitList routines are called before DLL termination routines.
Return Value
_tmem_term returns 0 if the memory functions were
successfully terminated. A return value of -1 indicates an error.
![]()
_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
_rmem_term -- Terminate Memory
Functions for Subsystem DLL