A tool for converting C and Objective-C headers to D modules
C D Makefile C++ PowerShell Objective-C
Permalink
Failed to load latest commit information.
bin Compile as 32bit binary for now. Jan 24, 2012
clang Fix test breakage by adding stdbool.h as an internal header Oct 23, 2016
dstep Fix deprecations for upcoming DMD 2.072.2 Oct 23, 2016
resources Fix test breakage by adding stdbool.h as an internal header Oct 23, 2016
test_files Fix #8: Typedef and anonymous structs. Sep 8, 2016
unit_tests Regression: translating typedef of array. Sep 26, 2016
.editorconfig Add .editorcofig matching current style Jul 25, 2016
.gitignore Make dstep to compile on MS Windows. Aug 17, 2016
.gitmodules Factor out common application code to new project. May 3, 2012
.travis.yml Add latest versions of DMD to the Travis CI config Oct 23, 2016
CONTRIBUTING.md Add CONTIBUTING.md. Aug 8, 2016
README.markdown Bump minimum requirement of DMD in the readme Oct 23, 2016
appveyor.ps1 Change wording of readme. Aug 20, 2016
appveyor.yml Change wording of readme. Aug 20, 2016
build.bat Add build script for Windows. Oct 27, 2013
build.sh Fix #44: Debian 0.2.1 release on Fedora Rawhide Jan 16, 2016
changelog.md Update changelog. Sep 26, 2016
dub.json Bump minimum requirement of macOS to 10.7. Oct 3, 2016
dub.selections.json Remove unused dependencies from dub.json Aug 14, 2016
run.sh Fix #49: Function-typed parameter is not handled Feb 14, 2016
test.d Make CI work with x86 and x64. Aug 18, 2016
todo.taskpaper Replace tabs with spaces. Jan 24, 2015
unittest.d Fix #47: Adds support for preprocessor constants. May 28, 2016

README.markdown

DStep

DStep is a tool for translating C and Objective-C headers to D modules.

Download

For the latest release see: releases/latest.

Pre-compiled binaries are available for OS X, Linux and FreeBSD, as 64bit. See the releases section.

Arch packages are available in [community] repository (thanks to Михаил Страшун):

https://www.archlinux.org/packages/?q=dstep

Alternatively install via Dub

License

The source code is available under the Boost Software License 1.0

Building

Posix

Requirements

Building

  1. Install all requirements, see above
  2. Clone the repository by running:

    $ git clone git://github.com/jacob-carlborg/dstep.git
    
  3. Run dub build

Windows

Requirements

Building

  1. Install all requirements, see above
  2. Clone the repository by running:

    $ git clone git://github.com/jacob-carlborg/dstep.git
    
  3. Run dub build --build=release to build 32-bit version

  4. Run dub build --arch=x86_64 --build=release to build 64-bit version

Remarks

Building 32-bit version requires a 32-bit variant of the Visual Studio toolchain to be present in PATH. The same for 64-bit. Remember not to specify -arch=x86 when building 32-bit version (dub will overwrite -m32mscoff with unsupported -m32 switch). If you use libclang versions <= 3.7, you may need to install MinGW for header files. Remember to install LLVM to its default installation path and to add its binaries to the PATH environmental variable (otherwise you may need to change dub.json).

Usage

$ dstep Foo.h -o Foo.d

For translating Objective-C headers add the -ObjC flag.

$ dstep Foo.h -o Foo.d -ObjC

For translating multiple files at once, simply pass all the files to dstep. In this case though, -o (if given) would point to output directory name. The directory will be created if it doesn't exist.

$ dstep Foo1.h Foo2.h Foo3.h .... FooN.h -o ./outputDirectory/

Use -h for usage information. Any flags recognized by Clang can be used.

Limitations/Known issues

  • Doesn't translate preprocessor macros, with exception to simple constants and functions.
  • Doesn't translate #include to import. A few standard C headers are translated
  • Doesn't translate C++ at all
  • Umbrella headers. Some headers just serve to include other headers. If these other headers contain some form of protection, like #error, to be included directly this can cause problems for DStep
  • Some headers are designed to always be included together with other header files. These headers may very well use symbols from other header files without including them itself. Since DStep is designed to convert header files one-by-one this doesn't work. There are two workarounds for this:

    1. Add #include-directives for the header files the header file is actually using
    2. Use the -include <file> flag available in Clang to indicate the given <file> should be processed before the file that should be translated. DStep accepts all flags Clang accepts