Runtime

This struct encapsulates all functionality related to the underlying runtime module for the calling context.

Members

Static functions

args
string[] args()

Returns the arguments supplied when the process was started.

cArgs
CArgs cArgs()

Returns the unprocessed C arguments supplied when the process was started. Use this when you need to supply argc and argv to C libraries.

collectHandler
void collectHandler(CollectHandler h)

Overrides the default collect hander with a user-supplied version. This routine will be called for each resource object that is finalized in a non-deterministic manner--typically during a garbage collection cycle. If the supplied routine returns true then the object's dtor will called as normal, but if the routine returns false than the dtor will not be called. The default behavior is for all object dtors to be called.

collectHandler
CollectHandler collectHandler()

Gets the current collect handler.

extendedModuleUnitTester
void extendedModuleUnitTester(ExtendedModuleUnitTester h)

Overrides the default module unit tester with a user-supplied version. This routine will be called once on program initialization. The return value of this routine indicates to the runtime whether the tests ran without error.

extendedModuleUnitTester
ExtendedModuleUnitTester extendedModuleUnitTester()

Gets the current module unit tester.

initialize
bool initialize()

Initializes the runtime. This call is to be used in instances where the standard program initialization process is not executed. This is most often in shared libraries or in libraries linked to a C program. If the runtime was already successfully initialized this returns true. Each call to initialize must be paired by a call to terminate.

loadLibrary
void* loadLibrary(const scope char[] name)

Locates a dynamic library with the supplied library name and dynamically loads it into the caller's address space. If the library contains a D runtime it will be integrated with the current runtime.

moduleUnitTester
void moduleUnitTester(ModuleUnitTester h)

Overrides the default module unit tester with a user-supplied version. This routine will be called once on program initialization. The return value of this routine indicates to the runtime whether the tests ran without error.

moduleUnitTester
ModuleUnitTester moduleUnitTester()

Gets the current legacy module unit tester.

terminate
bool terminate()

Terminates the runtime. This call is to be used in instances where the standard program termination process will not be not executed. This is most often in shared libraries or in libraries linked to a C program. If the runtime was not successfully initialized the function returns false.

traceHandler
void traceHandler(TraceHandler h)

Overrides the default trace mechanism with a user-supplied version. A trace represents the context from which an exception was thrown, and the trace handler will be called when this occurs. The pointer supplied to this routine indicates the base address from which tracing should occur. If the supplied pointer is null then the trace routine should determine an appropriate calling context from which to begin the trace.

traceHandler
TraceHandler traceHandler()

Gets the current trace handler.

unloadLibrary
bool unloadLibrary(void* p)

Unloads the dynamic library referenced by p. If this library contains a D runtime then any necessary finalization or cleanup of that runtime will be performed.

Suggestion Box / Bug Report