Porting a Matlab Toolbox to Scilab
What you must do to port a matlab mex toolbox ?
An API which translates mex call into scilab call exits. There are some explanations in SCIDIR/lib/scilab-4.1/examples/mex-examples.
In this directory you will find :
- how to link a C mex file in the cmex directory;
- how to link a fortran mex file in the fmex directory;
- how to link a C++ mex file in the cppmex directory.
The include files with the mex prototypes can be found in SCIDIR/lib/scilab-4.1/routines (it's mex.h).
The mex-examples demonstrate that it is relatively straightforward to convert a mex file into a form that can be loaded by Scilab. You may have to tweak the source slightly depending on how strict your current compiler/linker is relative to the original.
Another hurdle is the translation of the associated m files. The program mfile2sci can be used to do this conversion. While mfile2sci makes many excellent guesses about how to convert your m file to scilab, you may need to examine the converted file and tweak it slightly; needed tweaks are usually signaled by an inline comment mfile2sci inserted above the questionable line during the conversion process.
Thus the total process for mex conversion and m file conversion is not completely automatic as of version 4.1.x, and make take some time to massage into shape.