dwin - Simplify Windows Programming for D

The purpose of the library is to make Win32 programming easier by giving a more D like interface while taking advantage of D's safety features.

Quick Links:

This is not meant as a OS independent library, and I will not, by far, wrap every win32 function.
Because of this, the library exposes all win32 handles where possible so you can mix regular win32 with this library.

It is a thin wrapper, meaning there are no deep class hieriarcies, and is modelled very much like the win32 calls and using mostly the same names.

The best solution would of course be if Phobos, the standard library, included all functionality, but this is difficult as everything in the stdlib should be cross platform.
Hopefully Phobos will get much of win32's functionality in time, but until then, there's dwin.

Remarks:

Contributing

As with most open source projects, this project too needs contributors to succeed.

Remember that there are more ways to contribute than just writing code.
The important thing is not how much you contribute, or how groundbreaking the contribution is, just that you do something!

Everything you contribute to this project has to be licensed under Boost License 1.0 or a more liberal license (like Public Domain ).

What you can do to help: Getting started:
  1. Fork the project in github
  2. Compile the library
  3. Add your name to ALL_AUTHORS in dwin.ddoc for fame and glory!
  4. Hack away and have fun! (remember to add unittests)
  5. Build the library using build_all.bat, and run the tests with test.exe
  6. Document your new features, breaking changes and bugfixes in changelog.dd.
  7. Send a pull request
  8. Back to 4
Useful links:

HALL OF FAME

Contribute to get your name on the wall ;)

Contributors:
Simen Endsjø, Skybert

Modules

The modules are loosely modelled after the categories in MSDN: Windows API List.
build
Tool to build the dwin project
test
Runs tests for the dwin project
dwin.core
Utilities for wrapping win32 functions
dwin.nls
National Language Support. Globalization and localization features
dwin.process
Processes and threads
dwin.keyboard
Keyboard
dwin.console
Console
dwin.window
GUI

Installation

Update your sc.ini file to search the library and import folder:

EXT = "C:\d\ext"
DWIN="%EXT%\dwin"
DWIN_LIB="%DWIN%\lib"
DWIN_IMP="%DWIN%\import"

LIB="%@P%\..\lib";\dm\lib;%DWIN_LIB%
DFLAGS="-I%@P%\..\..\src\phobos" "-I%@P%\..\..\src\druntime\import" "-I%DWIN_IMP%"

Binary distribution

If you don't want to build the library yoursely, you can download the binary distribution
Remember to copy or move dwin\lib\kernel32.lib to "path\to\dmd\lib\kernel32.lib"

Compiling from source

Download the dwin source code.

Download the win32 bindings from the project page , and put it in [dwin folder]\src\win32 folder.
If you have svn installed, you can run fetch_win32_src.bat
If you already have win32, you can just create a symlink.

The win32 libraries that ships with DMD is not up to date with the latest version of windows.
First you need to install the Windows SDK.
Then download COFFIMPLIB.
Use COFFIMPLIB to convert kernel32.lib:

coffimplib "path/to/win/sdk/kernel32.lib" "path/to/dmd/lib/kernel32.lib"

And finally, all should be ready to build the library:

build_all.bat
After you have run the batch file, you can run build.exe directly to rebuild only parts of the project.
Run build.exe without parameters to see the options.

dwin.lib includes the entire win32.lib, so unless you are going to hack on dwin, win32.lib is not needed after compiling dwin.lib

Example

module example;
pragma(lib, "dwin.lib");
import dwin.nls;
void main() {
}
Run it (you must always have these versions when building dwin programs):
dmd -version=Unicode -version=WindowsVista -run example

Page generated by Ddoc. Copyright © 2011-2011 by Simen Endsjø, All Rights Reserved