Code Monkey home page Code Monkey logo

windows-win32-d's Introduction

Win32 API definitions for D

Win32 API definitions generated by Windows.Win32.winmd. (from win32metadata project)

This project aims to replace core.sys.windows.

Usage

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.

Naming rules for packages and modules

  • 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, only System.Guid type is supported as windows.win32.guid.GUID.
  • 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)

Policies

  • Not all CLI specifications are supported.
    • assert(0) means This pattern of data does not appear in Windows.Win32.winmd.
  • HANDLE and GDI 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] ... +/

Limitations

  • 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 in usePackageModule mode causes unexplained linker errors.

References

windows-win32-d's People

Stargazers

 avatar Jasmine Hegman avatar Brad Svercl avatar Andrey Penechko avatar  avatar Ezneh avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.