Difference between revisions of "Win32 DLLs in D"
(Migrating from http://dlang.org/dll.html) |
|||
Line 1: | Line 1: | ||
DLLs (Dynamic Link Libraries) are one of the foundations of system programming for Windows. The D programming language enables the creation of several different types of DLLs. | DLLs (Dynamic Link Libraries) are one of the foundations of system programming for Windows. The D programming language enables the creation of several different types of DLLs. | ||
+ | |||
+ | For background information on what DLLs are and how they work Chapter 11 of Jeffrey Richter's book [http://www.amazon.com/exec/obidos/ASIN/1572315482/classicempire Advanced Windows] is indispensible. | ||
+ | |||
+ | This guide will show how to create DLLs of various types with D. | ||
+ | |||
+ | == Compiling a DLL == | ||
+ | Use the [https://dlang.org/dmd-windows.html#switch-shared -shared] switch to tell the compiler that the generated code is to be put into a DLL. Code compiled for an EXE file will use the optimization assumption that '''_tls_index==0'''. Such code in a DLL will crash. |
Revision as of 10:48, 24 February 2014
DLLs (Dynamic Link Libraries) are one of the foundations of system programming for Windows. The D programming language enables the creation of several different types of DLLs.
For background information on what DLLs are and how they work Chapter 11 of Jeffrey Richter's book Advanced Windows is indispensible.
This guide will show how to create DLLs of various types with D.
Compiling a DLL
Use the -shared switch to tell the compiler that the generated code is to be put into a DLL. Code compiled for an EXE file will use the optimization assumption that _tls_index==0. Such code in a DLL will crash.