Thread Subject: Problem with MEX-FORTRAN files

Subject: Problem with MEX-FORTRAN files

From: Jairo Carlin

Date: 20 Jan, 2012 18:00:08

Message: 1 of 3

Hi, everybody

I am using a mex to pass variables to fortran project. When I run from matlab at first time, everything is ok. But when I do that again, with the same condition (all the same), Matlab close with a windows: "MATLAB has encountered an internal problem and needs to close". I have been running all the process in debug mode and I traced the problem at LAPACK subroutine which run in one fortran program. But It is rare, beacause all the input variables for the lapack subroutine are the same (in the first and in the second running).

Anyone can help me?

Thanks

Subject: Problem with MEX-FORTRAN files

From: dpb

Date: 21 Jan, 2012 15:25:54

Message: 2 of 3

On 1/20/2012 12:00 PM, Jairo Carlin wrote:
> Hi, everybody
>
> I am using a mex to pass variables to fortran project. When I run from
> matlab at first time, everything is ok. But when I do that again, with
> the same condition (all the same), Matlab close with a windows: "MATLAB
> has encountered an internal problem and needs to close". I have been
> running all the process in debug mode and I traced the problem at LAPACK
> subroutine which run in one fortran program. But It is rare, beacause
> all the input variables for the lapack subroutine are the same (in the
> first and in the second running).
>
> Anyone can help me?

Not w/o the interface code at the minimum, no.

Undoubtedly you have a problem of some sort that translates to a
dangling pointer, bounds error or some other fatal error in the mex
interface or in the call to the LAPACK routine.

Have you used all possible compiler error options including undefined
variables, array bounds checking, no optimization, etc., etc., etc., ...?

--

Subject: Problem with MEX-FORTRAN files

From: James Tursa

Date: 22 Jan, 2012 19:36:25

Message: 3 of 3

"Jairo Carlin" wrote in message <jfca38$r4d$1@newscl01ah.mathworks.com>...
> Hi, everybody
>
> I am using a mex to pass variables to fortran project. When I run from matlab at first time, everything is ok. But when I do that again, with the same condition (all the same), Matlab close with a windows: "MATLAB has encountered an internal problem and needs to close". I have been running all the process in debug mode and I traced the problem at LAPACK subroutine which run in one fortran program. But It is rare, beacause all the input variables for the lapack subroutine are the same (in the first and in the second running).
>
> Anyone can help me?

Not without seeing your code. You likely have a bug related to mismatched type for the arguments (e.g., integer*4 vs integer*8 or the like), or maybe your work arrays aren't big enough, etc, etc.

James Tursa

Tags for this Thread

Everyone's Tags:

mex

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Tag Activity for This Thread
Tag Applied By Date/Time
mex Jairo Carlin 20 Jan, 2012 13:00:58
rssFeed for this Thread

Contact us at files@mathworks.com