dstep ~cirrus
A tool for translating C and Objective-C headers to D modules
To use this package, run the following command in your project's root directory:
Manual usage
Put the following dependency into your project's dependences section:
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
- libclang - http://clang.llvm.org - 6.0.0 or 7.0.0
- A D compiler - The latest version of DMD or LDC
- Dub http://code.dlang.org/download (also shipped with the compilers)
Building
- Install all requirements, see above
- Clone the repository by running:
$ git clone git://github.com/jacob-carlborg/dstep.git
- Run
dub build
A configuration script will try to automatically locate libclang by looking
through a couple of default search paths. If libclang is not found in any of the
default paths, please manually invoke the configuration script and specify the
path to where libclang is installed using the --llvm-path
flag.
$ ./configure --llvm-path /usr/lib/llvm-4.0/lib
Windows
Requirements
- LLVM - http://llvm.org/releases/download.html - pre-built binaries for Windows
- DMD - http://dlang.org/download.html - 2.071.0 or later
- Dub - http://code.dlang.org/download
- Visual Studio - for example Visual Studio Community
Building
- Install all requirements, see above
- Clone the repository by running:
$ git clone git://github.com/jacob-carlborg/dstep.git
- Run
dub build --arch=x86_mscoff --build=release
to build 32-bit version - 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 to specify --arch=x86_mscoff
when building 32-bit version. The architecture specification is mandatory as with the default architecture or --arch=x86
dub will try to use unsupported OPTLINK
linker. OPTLINK
linker requires unsupported version of libclang binaries. 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
). When the program compiles under Windows but crashes at start, make sure an appropriate version of libclang.dll
is available for dstep (you can validate it easily by copying dll to the directory with dstep). Here you can find more information on the topic.
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
toimport
. 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:
- Add
#include
-directives for the header files the header file is actually using - 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
- Add
- Registered by Jacob Carlborg
- ~cirrus released 5 years ago
- jacob-carlborg/dstep
- github.com/jacob-carlborg/dstep
- BSL-1.0
- Copyright (c) 2011-2016 Jacob Carlborg. All rights reserved.
- Authors:
- Dependencies:
- none
- Versions:
-
1.0.4 2023-Jun-06 1.0.3 2021-Jul-31 1.0.2 2021-Jan-22 1.0.1 2019-Apr-28 1.0.0 2019-Apr-19 - Download Stats:
-
-
0 downloads today
-
0 downloads this week
-
7 downloads this month
-
1278 downloads total
-
- Score:
- 2.4
- Short URL:
- dstep.dub.pm