Report a bug
If you spot a problem with this page, click here to create a Bugzilla issue.
Improve this page
Quickly fork, edit online, and submit a pull request for this page. Requires a signed-in GitHub account. This works well for small changes. If you'd like to make larger changes you may want to consider using a local clone.

core.sys.windows.dll

This module provides OS specific helper function for DLL support
License:
Distributed under the Boost Software License 1.0. (See accompanying file LICENSE)
Authors:
Rainer Schuetze
bool dll_process_attach(HINSTANCE hInstance, bool attach_threads, void* tlsstart, void* tlsend, void* tls_callbacks_a, int* tlsindex);
To be called from DllMain with reason DLL_PROCESS_ATTACH
fixup TLS storage, initialize runtime and attach to threads
Returns:
true = success, false = failure
bool dll_process_attach(HINSTANCE hInstance, bool attach_threads = true);
same as above, but checking for shared runtime
void dll_process_detach(HINSTANCE hInstance, bool detach_threads = true);
to be called from DllMain with reason DLL_PROCESS_DETACH
bool isSharedDRuntime();
Check whether the D runtime is built as a DLL or linked statically
Returns:
true = DLL, false = static library
bool dll_thread_attach(bool attach_thread = true, bool initTls = true, HINSTANCE hInstance = null);
To be called from DllMain with reason DLL_THREAD_ATTACH
Returns:
true for success, false for failure
bool dll_thread_detach(bool detach_thread = true, bool exitTls = true, HINSTANCE hInstance = null);
To be called from DllMain with reason DLL_THREAD_DETACH
Returns:
true for success, false for failure
template SimpleDllMain()
A mixin to provide a DllMain which calls the necessary D runtime initialization and termination functions automatically.

Example

module dllmain;
import core.sys.windows.dll;
mixin SimpleDllMain;