- SWIG is an interface compiler that connects programs written in C and C++ with scripting languages such as Perl, Python, Ruby, and Tcl. It works by taking the declarations found in C/C++ header files and using them to generate the wrapper code that scripting languages need to access the underlying C/C++ code. In addition, SWIG provides a variety of customization features that let you tailor the wrapping process to suit your application.
- This guide will cover how to run Swig.
Walkthrough: Run Swig on the Cluster¶
- This walkthrough will cover a simple example of the most primitive form of C++ class wrapping performed by SWIG. In this case, C++ classes are simply transformed into a collection of C-style functions that provide access to class members.
example.hcan be found here
Part 1: Running Swig¶
- Make sure you're in the directory that contains the
- To see what Swig versions are available and to load which modules, run
module spider swig, and load the ones you want.
module load swig/4.0.2-44lsd2 swig -c++ -python example.i
swigis used to transform the c++ classes.
- Output Files will also show up in this directory as well
Part 2: Collecting Results¶
- In the directory, you should now the
example_wrap.cxxfiles can be found here
- Congratulations! You successfully ran Swig on the cluster.