dstepgen.rb is a Ruby script that generates metadata as an XML representation of the Objective-C/C headers. The script is a modified version of BridgeSupport to better suite the needs to generate D files. The files generated by dstepgen.rb are called dstep files and have the file extension .dstep. Just like with BridgeSupport these files can be used to create bindings for other languages than D.
What's needed to run the script?
You basically need two things: Ruby and gem. All other needed libraries are available through gem. If you run Mac OS X 10.5 (Leopard) then you should already have Ruby and gem.
If you run the script with the "-h" option the help is displayed:
Usage: dstepgen.rb [options] <headers...> Options: -f, --framework FRAMEWORK Generate metadata for the given framework. -u, --umbrella FRAMEWORK Link againts the given umbrella framework. --64-bit Write 64-bit annotations. -o, --output FILE Write output to the given file. -c, --code FILE The path to a file with code to inject -d, --dependencies Write framework dependencies and exit -s, --option OPTION Pass OPTION to the compiler -e, --extra Included extra headers -x, --exclude HEADER Exclude the given header file -h, --help Show this message. -v, --version Show version. Use the `-h' flag or for help.
- Specifies a framework to generate metadata from. This can either be a name of a system framework like "Foundation" or a path to a custom framework like "/path/to/my/custom/Framework.framework".
- This will link against the given umbrella framework instead of the framework currently generating bindings for. This is useful if you generate bindings for a sub framework that is a part of an umbrella framework.
- Also generates 64bit specific metadata, for example the type "NSInteger" will be 32 bits long on 32bit operating systems and 64 bits long on 64bit systems.
- Where to place the output, defaults to stdout
- A path to a file with code to inject. This can be used to include type definitions or include other headers.
- Collects all the dependencies of the given framework and prints them to stdout.
- Pass the given option to the compiler that is used to get the types.
- Include extra headers in the file that is used to get the types.
- Exclude the given header from the file that is used to get the types.
Generate metadata of the Foundation framework and place the output in Foundation.dstep:
./dstepgen.rb -f Foundation -o Foundation.dstep
Generate metadata of two C header files:
./dstepgen.rb -o Headers.dstep HeaderA.h HeaderB.h
Revised BSD license also known as three clause BSD license. (L)GPL compatible.