Win32 API definitions generated by Windows.Win32.winmd
. (from win32metadata project)
This project aims to replace core.sys.windows
.
Clone this repository and build windows-win32.lib
(or windows-win32-debug.lib
) from windows-win32-d\windows-win32\source
.
git clone https://github.com/godmyoh/windows-win32-d.git
cd windows-win32-d\windows-win32
dub build --build=release --config=release --force
dub build --build=debug --config=debug --force
Instead of dub build
, dub-build.bat
in windows-win32-d
folder can be used.
You can import windows-win32-d\windows-win32\source
and link windows-win32-d\windows-win32\windows-win32.lib
instead of using core.sys.windows
.
Try following command to run an example program. (See dub.sdl
in windows-win32-d\example
)
cd ..\example
dub run
If you want to generate files under windows-win32-d\windows-win32\source
, dub run
in windows-win32-d\windows-win32-generator
.
cd ..\windows-win32-generator
dub run
Also the following commands can be used.
dub run -- usePackageModule
dub run -- appendUnderscore
dub run -- usePackageModule
is same as dub run
. See Naming rules for packages and modules
Instead of dub run
, dub-run-usePackageModule.bat
or dub-run-appendUnderscore.bat
in windows-win32-d
folder can be used.
- Common rules
- Packages and modules are lowercase of namespaces.
Windows.Win32.System.Console
->windows.win32.system.console
.
- Append an underscore to the module name if the module conflicts with a keyword.
Windows.Win32.System.Diagnostics.Debug.WebApp
->windows.win32.system.diagnostics.debug_.webapp
- Namespaces other than
Windows.Win32
are not supported. However, onlySystem.Guid
type is supported aswindows.win32.guid.GUID
.
- Packages and modules are lowercase of namespaces.
- In
usePackageModule
mode (default)- No additional rules. However, debug builds have limitations. See Limitations.
- In
appendUnderscore
mode- Append an underscore to the module name if the module conflicts with a package.
Windows.Win32.Media
->windows.win32.media_
(Windows.Win32.Media.* exists)
- Append an underscore to the module name if the module conflicts with a package.
- Not all CLI specifications are supported.
assert(0)
meansThis pattern of data does not appear in Windows.Win32.winmd
.
HANDLE
andGDI
objects are NOT strongly-typed structs. (see Principles in win32metadata)- If two declarations has the same name, comment out one declaration with
/+ [CONFLICTED] ... +/
. - If the declaration cannot be compiled for some reason, comment out with
/+ [UNSUPPORTED] ... +/
- When a field in a struct has the same name as the type name, an underscore is added to the field name to avoid compile errors.
- Bitfields are not translated.
Windows.Win32.Foundation.Metadata
is excluded.- Using
windows-win32-debug.lib
generated inusePackageModule
mode causes unexplained linker errors.
- microsoft/win32metadata
- ECMA-335 Common Language Infrastructure
- microsoft/winmd (C++ winmd parser)
- rumbu13/windows-d (Another D language projection)