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.