Mex-Files - GNU Octave
Description: GNU Octave

Next: Standalone Programs, Previous: Oct-Files, Up: Dynamically Linked Functions

### A.2 Mex-Files

Octave includes an interface to allow legacy mex-files to be compiled and used with Octave. This interface can also be used to share code between Octave and matlab users. However, as mex-files expose the matlab's internal API, and the internal structure of Octave is different, a mex-file can never have the same performance in Octave as the equivalent oct-file. In particular to support the manner in which mex-files access the variables passed to mex functions, there are a significant number of additional copies of memory when calling or returning from a mex function. For this reason, new code should be written using the oct-file interface discussed above if possible.