_tmem_init -- Initialize Memory Functions for Subsystem DLL (OS/2)

Format

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

Language Level: Extension
_tmem_init initializes the tiled memory functions for subsystem DLLs. (If your subsystem DLL does not use tiled memory, call _rmem_init instead of _tmem_init.) Although subsystems do not require a runtime environment (and therefore do not call _CRT_init), they do require the library memory functions. For DLLs that do use a runtime environment, the memory functions are initialized with the environment by _CRT_init.

By default, all DLLs call the IBM C and C++ Compilers _DLL_InitTerm function, which in turn initializes the tiled memory functions for you. However, if you are writing your own subsystem _DLL_InitTerm function (for example, to perform actions other than memory initialization and termination), you must call _tmem_init from your version of _DLL_InitTerm before you can call any other library functions.

If your DLL contains C++ code, you must also call __ctordtorInit after _tmem_init to ensure that static constructors and destructors are initialized properly. __ctordtorInit is defined in the runtime startup code as:

void __ctordtorInit(void);

Return Value
If the memory functions were successfully initialized, _tmem_init returns 0. A return code of -1 indicates an error. If an error occurs, an error message is written to file handle 2, which is the usual destination of stderr.



_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