Mex Out of Process with MinGW/MSYS2 and GSL

6 views (last 30 days)
I am trying to use the new mex out of process feature but my mex file only says "Invalid C++ MEX-file" when tried to run with the mexhost. I am compiling a cpp file with 'MinGW64 C++ Compiler' and using GSL-2.6 libraries. I think the second mexhost process cannot access the libraries needed to run the GSL section of my code.
I have the GSL dlls and libraries needed already linked to my PATH user environment variable, I have tried adding the DLLs directly to where my mex function is trying to run, and I have already ran dependency walker and nothing seems to be missing except for the API and EXE dlls which I've come to understand means those aren't missing, but something else is.
How can I make the second mexhost process have the same access to the dlls and libs as the main process? The purpose I am trying to do this for is to prevent Matlab from closing when the mex function errors out, I'd rather have that second process end and be able to debug the reason than have to go into a Matlab crash report. I am using 2019b and 2020a on two computers, both have the same issue.
  2 Comments
Evangelos Paradas
Evangelos Paradas on 31 May 2021
I have the same problem.
I also tried with the dependency walker and nothing is missing.
Strangely, if I try to run my MEX outside of the mexhost (without the feval) it runs.
Any ideas?
Kristen Bruchko
Kristen Bruchko on 1 Jun 2021
My problem ended up being the API I was using. I still had my mex file setup with the C Matrix API (with the mxArray data structure), but the out-of-process only works with the new C++ Mex API. You can find more details about the C++ API here. Hopefully your issue is that simple of a fix as well.

Sign in to comment.

Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!