0

I am trying to integrate to an existing Fortran code mycode.F a mwPointer. My mycode.F compiled correctly before any change I tried to make. Here's an extract:

  subroutine mycode(t1,t2,action,p1,p2,Q,flag) 

  implicit none 

  integer IZERO, IUN, IDEUX, ITROIS
  double precision  DZERO,DUN,DDEUX,DTROIS,flag
  parameter (IUN=1,IZERO=0,IDEUX=2,ITROIS=3,DZERO=0.0d0,DUN=0.1D1,DDEUX=0.2D1,DTROIS=0.3D1)

  double precision action, t1, t2, p1, p2, Q
  double precision Q2(10),D(10),time(10),G1(10),G(10,2),F(51) 

  integer i

  print *, 'Lorem'

  end

In order to use the engOpen function and following this Mathworks page, I modified my code to this:

#include         "fintrf.h"
#include         "engine.h"

      subroutine mycode(t1,t2,action,p1,p2,Q,flag,engOpen) 

      implicit none

      integer IZERO, IUN, IDEUX, ITROIS
      double precision  DZERO,DUN,DDEUX,DTROIS,flag 
      parameter (IUN=1,IZERO=0,IDEUX=2,ITROIS=3,DZERO=0.0d0,DUN=0.1D1,DDEUX=0.2D1,DTROIS=0.3D1) 

      double precision action, t1, t2, p1, p2, Q
      double precision Q2(10),D(10),time(10),G1(10),G(10,2),F(51)! 

      integer i

      mwPointer engOpen

      print *, 'Lorem'

      end

But when I compile, I get the following error:

mwPointer engOpen
1
Error: Unclassifiable statement at (1)
Error: Symbol 'engopen' at (1) has no IMPLICIT type

Would anyone know how to solve this?

Thanks for your help

elle.delle
  • 328
  • 3
  • 15

1 Answers1

-1

The Mathworks page gave you bad, or at least incomplete advice. It is assuming that your Fortran source will be run through a cpp-style preprocessor, which is not standard in Fortran. With most Fortran compilers on UNIX/Linux style systems, the use of a .F (capital F) file type would run the source through a preprocessor first, but that doesn't necessarily happen everywhere. (You did not say which compiler and operating system you are using.)

Study your compiler's documentation and, if available, enable the option to have the source run through a preprocessor before compilation.

Steve Lionel
  • 6,972
  • 18
  • 31