Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
#include mex.h breaks Fortran?

Subject: #include mex.h breaks Fortran?

From: Karl

Date: 29 Nov, 2007 18:40:22

Message: 1 of 2

On the Matlab webpage (link below), it says that in order to
correctly write a mex file in Fortran, you must #include
mex.h. However, when I do just that - using the sample code
provided by Matlab (timestwo.F) - it doesn't compile. If I
leave off the #include, then it works fine. What is going
on here? Do I need mex.h or not?

http://www.mathworks.com/access/helpdesk/help/techdoc/index.html?/access/helpdesk/help/techdoc/matlab_external/f33356.html&http://www.google.com/search?q=matlab+fintrf.h&ie=utf-8&oe=utf-8&aq=t&rls=org.mozilla:en-US:official&client=firefox-a

Subject: #include mex.h breaks Fortran?

From: James Tursa

Date: 29 Nov, 2007 19:40:34

Message: 2 of 2

"Karl " <kNsOtSaPhAlM@stanford.edu> wrote in message
<fin12m$ila$1@fred.mathworks.com>...
> On the Matlab webpage (link below), it says that in
order to
> correctly write a mex file in Fortran, you must #include
> mex.h. However, when I do just that - using the sample
code
> provided by Matlab (timestwo.F) - it doesn't compile.
If I
> leave off the #include, then it works fine. What is
going
> on here? Do I need mex.h or not?
>
>

Do *not* include mex.h for Fortran files. That is only for
C or C++ files. What you need to include instead is
fintrf.h:

#include "fintrf.h"

      subroutine mexFunction( etc...

James Tursa

Tags for this Thread

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.

Contact us