View previous topic :: View next topic |
Author |
Message |
jjgermis
Joined: 21 Jun 2006 Posts: 404 Location: N�rnberg, Germany
|
Posted: Mon Aug 10, 2009 12:09 pm Post subject: Matlab engine form a Fortran program |
|
|
Hi FTN95 Users,
I am trying to use the Matlab enige from a Fortran program. According to the supplied example in the Matlab-Help I need to include <fintrf.h>. This file has the following content (only part of it):
Code: |
#if defined(WITH_COMMENTS)
/*
* fintrf.h - MATLAB/FORTRAN interface header file. This file
* contains the declaration of the pointer type needed
* by the MATLAB/FORTRAN interface.
*
* Copyright 1984-2006 The MathWorks, Inc.
* All Rights Reserved.
*/
#endif
#if defined(__x86_64__) || defined(_M_AMD64) || defined(__amd64) || defined(__sparcv9) || defined(__ppc64__)
# define mwpointer integer*8
# define mwPointer integer*8
# define MWPOINTER INTEGER*8
#else
# define mwpointer integer*4
# define mwPointer integer*4
# define MWPOINTER INTEGER*4
#endif
...
|
FTN95 is (unfortunatley) not supported by Matlab and the # might not be allowed. What is the neccesary changes which I need to make to be able to complie this include?
Johannes |
|
Back to top |
|
|
jjgermis
Joined: 21 Jun 2006 Posts: 404 Location: N�rnberg, Germany
|
Posted: Mon Aug 10, 2009 6:39 pm Post subject: |
|
|
Hi everyone,
this seems to be a known problem. I found the same comments in the Mathworks forum:
http://www.mathworks.com/matlabcentral/newsreader/view_thread/135815
http://www.mathworks.in/matlabcentral/newsreader/view_thread/164128
It seems like with each new version of Matlab the "logic" changes a bit. I would be glad if someone in the Silverfrost Forum could answer the following:
does the linker/compiler have a switch like -cpp to compile Fortran and C;
does anyone have some working example of calling the Matlab engine with FTN95?
Any advice in this context will be most welcome!
Johannes |
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 7938 Location: Salford, UK
|
Posted: Tue Aug 11, 2009 8:12 am Post subject: |
|
|
Fortran code can be compiled with FTN95.
C/C++ code can be compiled with SCC.
SLINK can be used to link object files produced by either FTN95 or SCC or SRC (i.e. you could have a mixture of files in one linking process).
The only examples I know about are in the download that is given in the KBase article on Matlab in this forum. |
|
Back to top |
|
|
jjgermis
Joined: 21 Jun 2006 Posts: 404 Location: N�rnberg, Germany
|
Posted: Tue Aug 11, 2009 8:25 am Post subject: |
|
|
Hi Paul,
thanks. The example in the KBase forum explains how to use a Fortran program as a m-file in the Matlab environment.
In the present topic the aim is to use Matlab functions from a Fortran program, i.e. the other way arround. I have worked through the example provided in the Matlab documentation without success.
Even though I assume that the solution must be quit simple, the Mathworks hotline only argue that FTN95 is not supported.
Anyway, thanks for your reply.
Johannes |
|
Back to top |
|
|
|