|   | Prev | Next | 
 
%{
# include "swig_xam.hpp"
%}
 
# ifdef SWIGPYTHON
%module py_swig_xam
# endif
 
# ifdef SWIGOCTAVE
%module m_swig_xam
# endif
 
# ifdef SWIGPERL
%module pl_swig_xam
# endif
     std::exception::runtime_error(const std::string& what)
 
%include exception.i
%exception {
   try {
        $action
    } catch (std::runtime_error& e) {
        SWIG_exception(SWIG_RuntimeError, const_cast<char*>( e.what() ) );
    }
}
 
%include "cpointer.i"
%pointer_class(int, int_class);
 
%include "carrays.i"
%array_functions(int, int_array_ptr);
 
%array_class(int, int_array_class);
std::vector<Type>
where 
Type
 is double.
 
%include "std_vector.i"
%template(vector_double) std::vector<double>;
 
%include "swig_xam.hpp"
template_class<Type>
where Type
 is double.
Note that it uses template_class
which is defined as part of swig_xam.hpp.
 
%template(double_class)  template_class<double>;
| swig_xam.hpp | Example C++ Library That is Called by Swig | 
| check_swig_xam.py | Swig Example / Test: Python Script | 
| check_swig_xam.m | Swig Example / Test: Octave Script | 
| check_swig_xam.pl | Swig Example / Test: Perl Script |