HI Matlab central community. I tried to ask this question in StackOverflow but I could not resolve it. I compile a mex file in VIsual Studio 2013, which is very basic:
void mexFunction(int nlhs, mxArray *plhs, int nrhs, const mxArray *prhs)
This compiles as a mexw64 succesfully. I then open up MATLAB v2016a, and try to run mcx() with no input parameters and mcx(cfg) where cfg has 1,2 or 3 parameters. Each different scenario cases MATLAB to crash, end prematurely. I attach visual studio to MATLAB, and I get the error:
'MATLAB.exe' (Win32): Loaded 'C:\Users\tub08918\Google Drive\Patil Lab\AlexsFolderPleaseVisitMe\RamanMonteCarlo\mcx-2017.3-src\mcx\vsproj\mcx\x64\Debug\mcx.mexw64'. Symbols loaded.
First-chance exception at 0x00000000000260A8 in MATLAB.exe: 0xC0000005: Access violation executing location 0x00000000000260A8.
throw_segv_longjmp_seh_filter(): invoking THROW_SEGV_LONGJMP SEH filter
MATLAB.exe has triggered a breakpoint.
Now the aim is to compile a file with CUDA capabilities, bu I can't even figure out what is causing this very simple ne-line code to fail. My props file comes from https://github.com/chappjc/MATLAB/tree/master/propertySheets. My build is x64 and I made sure to compile as x64. I tried using a new project that didnt help, so I am out of ideas why this simple code would be compiling as a mex file but failing when called from MATLAB. Interstingly, if I leave mexFunction blank, then MATLAB does not crash. IF I have some easy operations, like 2+2, MATLAB does not failk. It seems to happen when I call any function built into c++ or from mex.h