Matwrap: a wrapper generator for matrix languages

Matwrap is a tool for interfacing C++ code into matrix-oriented scripting languages such as Matlab 5, Octave, and tela. It generates all the code to convert from the scripting language's internal types into the types that your C++ code understands (e.g., double, char *, float *, struct abc *). You do not need to understand any of the API details of the language to use your C++ code; just give matwrap a .h file describing your functions.

Brief list of features:

For a few short examples, see the expanded feature description. Matwrap is available free of charge under the terms of the artistic license.

Available from this site:

Several examples are contained in the distribution, including the wrapper for the pgplot plotting library, and a neuron simulator written as a C++ class. I'd like to include a lot more examples of its use, so feel free to send me anything that might be appropriate.

Matwrap requires a relatively recent version of perl (it was tested with version 5.004 and 5.005) and a C++ compiler that supports alloca (such as gcc). A C++ compiler is currently needed even if you are wrapping C code. Matwrap has been developed on unix; the generation of the wrapper code itself should be more or less the same on all platforms, but the procedure for linking the code to the scripting language will probably be different.


Other resources

The Mathtools web site is a good place for online information about matlab and extensions.

Another wrapper generator called SWIG exists for languages such as perl, python, and tcl. Someday, hopefully, the matrix handling features of Matwrap will be incorporated into SWIG, but for the moment they are entirely separate.


Last updated: 03 Jan 2001
Gary Holt