SWIG-1.3 Documentation SWIG-1.3 Documentation Table of Contents SWIG-1.3 Development Documentation
Total Page:16
File Type:pdf, Size:1020Kb
SWIG-1.3 Documentation SWIG-1.3 Documentation Table of Contents SWIG-1.3 Development Documentation...........................................................................................................................................1 Sections...................................................................................................................................................................................1 SWIG Core Documentation............................................................................................................................................1 Language Module Documentation..................................................................................................................................1 Developer Documentation...............................................................................................................................................1 Documentation that has not yet been updated.................................................................................................................2 1 Preface...............................................................................................................................................................................................3 1.1 Introduction.......................................................................................................................................................................3 1.2 Special Introduction for Version 1.3................................................................................................................................3 1.3 SWIG Versions.................................................................................................................................................................3 1.4 SWIG resources................................................................................................................................................................3 1.5 Prerequisites......................................................................................................................................................................4 1.6 Organization of this manual..............................................................................................................................................4 1.7 How to avoid reading the manual.....................................................................................................................................4 1.8 Backwards Compatibility.................................................................................................................................................4 1.9 Credits...............................................................................................................................................................................5 1.10 Bug reports......................................................................................................................................................................5 2 Introduction......................................................................................................................................................................................6 2.1 What is SWIG?.................................................................................................................................................................6 2.2 Why use SWIG?...............................................................................................................................................................6 2.3 A SWIG example..............................................................................................................................................................7 2.3.1 SWIG interface file.................................................................................................................................................7 2.3.2 The swig command.................................................................................................................................................8 2.3.3 Building a Perl5 module.........................................................................................................................................8 2.3.4 Building a Python module......................................................................................................................................8 2.3.5 Shortcuts.................................................................................................................................................................9 2.4 Supported C/C++ language features.................................................................................................................................9 2.5 Non-intrusive interface building.....................................................................................................................................10 2.6 Incorporating SWIG into a build system........................................................................................................................10 2.7 Hands off code generation..............................................................................................................................................10 2.8 SWIG and freedom.........................................................................................................................................................11 3 Getting started on Windows..........................................................................................................................................................12 3.1 Installation on Windows.................................................................................................................................................12 3.1.1 Windows Executable............................................................................................................................................12 3.2 SWIG Windows Examples.............................................................................................................................................12 3.2.1 Instructions for using the Examples with Visual Studio......................................................................................12 3.2.1.1 C#...............................................................................................................................................................13 3.2.1.2 Java.............................................................................................................................................................13 3.2.1.3 Perl.............................................................................................................................................................13 3.2.1.4 Python.........................................................................................................................................................13 3.2.1.5 TCL............................................................................................................................................................13 3.2.1.6 R.................................................................................................................................................................13 3.2.1.7 Ruby...........................................................................................................................................................14 3.2.2 Instructions for using the Examples with other compilers...................................................................................14 3.3 SWIG on Cygwin and MinGW......................................................................................................................................14 3.3.1 Building swig.exe on Windows............................................................................................................................14 3.3.1.1 Building swig.exe using MinGW and MSYS............................................................................................14 3.3.1.2 Building swig.exe using Cygwin...............................................................................................................15 3.3.1.3 Building swig.exe alternatives...................................................................................................................15 3.3.2 Running the examples on Windows using Cygwin..............................................................................................15 3.4 Microsoft extensions and other Windows quirks...........................................................................................................15 i SWIG-1.3 Documentation Table of Contents 4 Scripting Languages......................................................................................................................................................................16 4.1 The two language view of the world..............................................................................................................................16 4.2 How does a scripting language talk to C?......................................................................................................................16 4.2.1 Wrapper functions................................................................................................................................................17 4.2.2 Variable linking....................................................................................................................................................17