swig


Introduction:

SWIG is a tool that enables C and C++ functions to be called from
other languages.

Languages supported by SWIG include:

  • Android;
  • C#;
  • Chicken;
  • Common Lisp, (CLISP, Allegro CL, CFFI, UFFI);
  • D;
  • Go language;
  • Guile;
  • Java
  • Javascript;
  • Lua;
  • Modula-3;
  • MzScheme/Racket;
  • OCAML;
  • Octave;
  • Perl;
  • PHP;
  • R;
  • Ruby;
  • Scilab;
  • Tcl;

Web Site:

The SWIG home page at swig.org:

http://www.swig.org/

Reference:

Usage:

On any ARC cluster, check the installation details
by typing "module spider swig".

SWIG requires that the appropriate modules be loaded before it can
be used. One version of the appropriate commands for use on NewRiver is:

module purge
module load gcc/5.2.0
module load swig/3.0.11
    

Examples:

The following batch file demonstrates the use of SWIG:

#! /bin/bash
#
#PBS -l walltime=5:00
#PBS -l nodes=1:ppn=1
#PBS -W group_list=newriver
#PBS -q open_q
#PBS -j oe
#
cd $PBS_O_WORKDIR
#
module purge
module load gcc/5.2.0
module load swig/3.0.11
#
swig -python -I$CGAL_DIR/share/swig/3.0.11 -I$CGAL_DIR/share/swig/3.0.11/python example.i
#
gcc -c -fPIC -I /usr/include/python2.7 example.c example_wrap.c
#
gcc -shared example.o example_wrap.o -o _example.so
#
python example_test.py

A complete set of files to carry out a similar process are available in
swig_example.tar