C Interoperability ================== Generate Bindings ----------------- D can link with C libraries very easily. However, the header files must be converted into D bindings. Ideally, we could generate bindings from C header files automatically. In practice, you can either use `DStep `_ or do the conversion manually. If DStep succeeds, you have something to work with quickly. With the manual approach you can also port stuff like preprocessor macros to their respective D equivalents. Structurally, a two-level approach for bindings is recommended. On a first level try to clone the C API as close as possible. On the second level, you can optionally wrap convenience around, which exploits D-specific features. A repository of bindings is `Deimos `_. Please, submit bindings when you have created some. .. seealso:: `header to binding `_, `Dstep `_ C++ Interop ----------- More limited than C interop, but possible to a certain extend. .. seealso:: `Interfacing to C++ `_, `Using D Alongside a Game Engine, DConf 2013 talk by Manu Evans `_ Porting Code ------------ Porting C/C++ code to D is relatively easy, since the languages are very similar. .. seealso:: Converting `C to D `_, `C++ to D `_, `C Preprocessor to D `_,