· Overview · D for Win32 · Win32 DLLs in D · C .h to D Modules · FAQ · Style Guide · Example: wc · Future · D Change Log · Tech Tips · Rationale · Warnings Articles · Exception Safety · Templates Revisited Tools · DMD D Compiler · GDC D Compiler · Linker · Profiler · Code Coverage · DMD Script Shell · Windows Debugger Community · News · Forum · Announcements · Learn · D links Archives · digitalmars.D · digitalmars.D.dtl · digitalmars.D.announce · digitalmars.D.dwt · digitalmars.D.learn · digitalmars.D.bugs · D.gnu · Old D Appendices · Glossary · Ascii Table · Acknowledgements |
D for Win32This describes the D implementation for 32 bit Windows systems. Naturally, Windows specific D features are not portable to other platforms.Instead of the: #include <windows.h>of C, in D there is: import std.c.windows.windows;
Calling ConventionsIn C, the Windows API calling conventions are __stdcall. In D, it is simply:extern (Windows) { /* ... function declarations ... */ }The Windows linkage attribute sets both the calling convention and the name mangling scheme to be compatible with Windows. For functions that in C would be __declspec(dllimport) or __declspec(dllexport), use the export attribute: export void func(int foo);If no function body is given, it's imported. If a function body is given, it's exported. Windows ExecutablesWindows GUI applications can be written with D. A sample such can be found in \dmd\samples\d\winsamp.dThese are required:
|