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.
This simple example is given in considerable detail to give an idea of how it all works.
/Examples/Function in C
This example shows how to wrap a set of C++ classes including inheritance.
/Examples/Class in C++
This example shows how to control the insertion of import statements into the generated D code.
/Examples/Pragma in C++
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).
More to follow