[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Mex Fortran Interface
From: |
John W. Eaton |
Subject: |
Mex Fortran Interface |
Date: |
Mon, 8 Jan 2007 21:59:10 -0500 |
On 8-Jan-2007, Alexander Barth wrote:
| Hi all,
|
| I'm planning to interface a Fortran program to octave and matlab using the
MEX API. I tried to
| compile the example programs yprimef.F from matlab in octave 2.9.9 with
"mkoctfile --mex". I managed
| to get a working mex file by writing some small wrapper functions around the
MEX C interface
| (mex_fortran.cc). The file fintrf.h just defines the macro MWPOINTER
depending if you have a 32 or
| 64 bit system.
|
| I think it would be nice to have those functions in octave.
Sure, that would be nice and I would consider patches.
Please see this thread:
https://www.cae.wisc.edu/pipermail/bug-octave/2006-October/000995.html
I still think there can be portability problems with defining Fortran
functions (not subroutines) in C/C++, so probably the best way to
handle this is to write the Fortran wrappers in a combination of C/C++
and Fortran.
| #include <bits/wordsize.h> /* __WORDSIZE */
This does not look portable. I think you want to use some kind of
configure test instead.
| intptr_t
Is this from stdint.h? I don't think Octave sources currently require
c99, so we should probably use a configure test for this too.
| // do we need to add \0 at the end of s?
| mexErrMsgTxt(s);
I would guess yes.
jwe