Dwith Swig /
Examples
Examples of use of D with SWIG
These examples are intended to help the implementer of an interface to understand how to use SWIG to enable an existing C or C++ code to be made available in D. Each example shows use of SWIG to generate wrapping code and also how to compile and link the mixed language codes under either /Linux or /Windows.
Simple C function
This simple example is given in considerable detail to give an idea of how it all works.
/Examples/Function in C
C++ Class
This example shows how to wrap a set of C++ classes including inheritance.
/Examples/Class in C++
C++ Classes and pragma statements
This example shows how to control the insertion of import statements into the generated D code.
/Examples/Pragma in C++
C++ for extended precision calculation
This example of wrapping a class with real functionality demonstrates a number of further techniques for wrapping code.
- module level import statements
- extend command to add functionality
- overloaded operators in the target language (D).
C++ for symbolic manipulation using GiNaC
More to follow