Building Mex file with Fortan
Show older comments
I am trying to understand how to build mex files. I made following test code It compiles using the Visual Fortran Compiler 2011 but when i try to call it matlab shuts down with the message segmentation violation detected. Does anyone sees what goes wrong?
if true
#include <fintrf.h>
C
C Gateway routine
C
SUBROUTINE MEXFUNCTION(NLHS, PLHS, NRHS, PRHS)
C mexFunction arguments:
MWPOINTER PLHS(*), PRHS(*)
MWPOINTER NLHS, NRHS
mwPointer mxGetPr,mxGetPi
mwPointer mxCreateDoubleMatrix,mxCreateNumericArray
mwSize mxGetM, mxGetN
MWPOINTER YPP
REAL *8 RYPP(1)
YPP = MXGETPR(PLHS(1))
RYPP(1) = 10
CALL MXCOPYREAL8TOPTR(RYPP, YPP, 1)
RETURN
END
end
Accepted Answer
More Answers (0)
Categories
Find more on MATLAB Compiler in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!