"Sudarshan " <firstname.lastname@example.org> wrote in message <email@example.com>... > Hey guys, > > I am new to MEX-ing and using an MEX function written by somebody else a long time back. I have gotten it to compile and link correctly. However, on execution of the main program, MATLAB crashes and i get an error saying that there was a "segmentation violation while the MEX file was running". I don't know what to do. Any help in this regard would be really awesome.
Are you running 32-bit or 64-bit? What version of MATLAB are you using?
I see potential problems with your use of "integer" as a pointer (will need to be integer*8 on 64-bit systems ... i.e. should use mwPointer instead).
Also the mxCreateFull function is deprecated, and has been for quite some time, so this must be very old code.
Is it your intent to simply call the pr_equil function with MATLAB inputs & outputs? If so, this can probably be done much simpler.