This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

mexLock (C and Fortran)

Prevent clearing MEX-file from memory

C Syntax

#include "mex.h"
void mexLock(void);

Fortran Syntax

#include "fintrf.h"
subroutine mexLock()


By default, MEX files are unlocked, meaning you can clear them at any time. Call mexLock to prohibit clearing a MEX file.

To unlock a MEX file, call mexUnlock. Do not use the munlock function.

mexLock increments a lock count. If you call mexLock n times, call mexUnlock n times to unlock your MEX file.


See these examples in matlabroot/extern/examples/mex: