core.runtime
The runtime module exposes information specific to the D runtime code.
Copyright
Copyright Sean Kelly 2005 - 2009.
Module Initializers 1
shared static this
()Types 8
structUnitTestResult
This type is returned by the module unit test handler to indicate testing results.
Fields
size_t executedNumber of modules which were testedsize_t passedNumber of modules passed the unittestsbool runMainShould the main function be run or not? This is ignored if any tests failed.bool summarizeShould we print a summary of the results?UnitTestResult passSimple return code that says unit tests pass, and main should be runUnitTestResult failSimple return code that says unit tests failed.Methods
bool opCast(T : bool)() constSimple check for whether execution should continue after unit tests have been run. Works with legacy code that expected a bool return.aliasModuleUnitTester = bool function()
Legacy module unit test handler
aliasExtendedModuleUnitTester = UnitTestResult function()
Module unit test handler
aliasCollectHandler = bool function(Object)
aliasTraceHandler = Throwable.TraceInfo function(void * ptr)
aliasExceptionHandler = void delegate(Throwable)
structCArgs
Stores the unprocessed arguments supplied when the process was started.
Fields
int argcchar * * argvstructRuntime
This struct encapsulates all functionality related to the underlying runtime module for the calling context.
Methods
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...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...CArgs cArgs() @property @nogcReturns the unprocessed C arguments supplied when the process was started. Use this when you need to supply argc and argv to C libraries.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.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.void traceHandler(TraceHandler h,
Throwable.TraceDeallocator d = null) @propertyOverrides 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 p...void collectHandler( CollectHandler h ) @propertyOverrides 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 ...void extendedModuleUnitTester( ExtendedModuleUnitTester h ) @propertyOverrides 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...Functions 15
fn
int rt_unloadLibrary(void * ptr)C interface for Runtime.unloadLibrary, returns 1/0 instead of boolfn
void _d_print_throwable(Throwable t)fn
void trace_setlogfilename(string name)Set the output file name for profile reports (-profile switch). An empty name will set the output to stdout.fn
void trace_setdeffilename(string name)Set the output file name for the optimized profile linker DEF file (-profile switch). An empty name will set the output to stdout.fn
void profilegc_setlogfilename(string name)Set the output file name for memory profile reports (-profile=gc switch). An empty name will set the output to stdout.fn
UnitTestResult runModuleUnitTests() This routine is called by the runtime to run module unit tests on startup. The user-supplied unit tester will be called if one has been set, otherwise all unit tests will be run in sequence. I...fn
Throwable.TraceInfo defaultTraceHandler( void * ptr = null )Get the default `Throwable.TraceInfo` implementation for the platformfn
void defaultTraceDeallocator(Throwable.TraceInfo info) nothrowDeallocate a traceinfo generated by deaultTraceHander.