X-Git-Url: https://git.llucax.com/software/druntime.git/blobdiff_plain/4926e6ef8c37680c8e5ce47d9cddd03819ae84af..1d6b260d32d802b99dcdd3c9e9e3b97c19d3f856:/src/common/core/runtime.d diff --git a/src/common/core/runtime.d b/src/common/core/runtime.d index 76a9438..36607be 100644 --- a/src/common/core/runtime.d +++ b/src/common/core/runtime.d @@ -22,6 +22,9 @@ private alias void delegate( Exception ) ExceptionHandler; extern (C) bool rt_init( ExceptionHandler dg = null ); extern (C) bool rt_term( ExceptionHandler dg = null ); + + extern (C) void* rt_loadLibrary( in char[] name ); + extern (C) void rt_unloadLibrary( void* ptr ); } @@ -88,6 +91,37 @@ struct Runtime } + /** + * 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. + * + * Params: + * name = The name of the dynamic library to load. + * + * Returns: + * A reference to the library or null on error. + */ + static void* loadLibrary( in char[] name ) + { + return rt_loadLibrary( name ); + } + + + /** + * 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. + * + * Params: + * p = A reference to the library to unload. + */ + static void unloadLibrary( void* p ) + { + rt_unloadLibrary( p ); + } + + /** * Overrides the default trace mechanism with s user-supplied version. A * trace represents the context from which an exception was thrown, and the