Format
int _rmem_init(void); /* no header file - defined in runtime startup code */
Language Level: Extension
_rmem_init initializes the memory functions for subsystem DLLs.
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 calls _rmem_init 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 _rmem_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 _rmem_init to ensure that static constructors and destructors are initialized properly. __ctordtorInit is defined in the runtime startup code as:
void __ctordtorInit(int flag);
See _CRT_init -- Initialize DLL Run-time Environment.
Return Value
If the memory functions were successfully initialized,
_rmem_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 Run-time
Environment
_CRT_term -- Terminate DLL Run-time
Environment
_DLL_InitTerm -- Initialize and
Terminate DLL Environment
_rmem_term -- Terminate Memory
Functions for Subsystem DLL
/Ge compiler option