Make async Requests Using mexCallMATLAB
Be aware of the behavior when calling back into MATLAB® using mexCallMATLAB with an async
request like matlab::engine::MATLABEngine::fevalAsync. The
mexCallMATLAB function is synchronous. After it launches a
function using the call to fevalAsync, the MEX function continues
to the end, returns to MATLAB, and is then unloaded. If the async processing of the
requested feval command tries to reference the MEX function, it
generates an exception.
Consider using the mexLock and mexUnLock
functions to ensure that the MEX function stays in memory while the
async function processes.