Mex files crashes when run
Afficher commentaires plus anciens
Hi. I have written and compiled a mex file from a Fortran source code. However, I have problems running it as Matlab crashes whenever I run the mex file. Can anybody find out where is the problem?
My fortran source code is as follows.
#include "fintrf.h"
C======================================================================
#if 0
C
C add.F
C .F file needs to be preprocessed to generate .for equivalent
C
#endif
C
C add.f
C
C Adds two integers
C
C======================================================================
C Gateway routine
subroutine mexFunction(nlhs, plhs, nrhs, prhs)
C Declarations
implicit none
C mexFunction arguments:
mwPointer plhs(*), prhs(*)
integer nlhs, nrhs
C Pointers to input/output mxArrays:
mwPointer a, b
mwPointer c
C Function Declerations
mwPointer mxGetData
a = mxGetData(prhs(1))
b = mxGetData(prhs(2))
c = mxGetData(plhs(1))
C Call the computational subroutine.
call add(%val(a), %val(b), %val(c))
return
end
C-----------------------------------------------------------------------
C Computational subroutine
subroutine add(a, b, c)
integer*8 a, b, c
c = a + b
return
end
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur COM Component Integration dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!