Declarations for C functions

First, let me say that I am definitely not a Fortran expert so this question may be dumb.

I am trying to compile some code that was last compiled with compaq visual fortran (this is some fortran 77 code). In this code I call some C routines. It looks like my declarations for these external routines may have been specific to the compaq compiler. Here is what one of these declarations looks like:

C ------------------------------------------------------------------
C Declare the C function
INTERFACE
SUBROUTINE mfLib_U2DREL(SUCCESS, IPRN, II, JJ, A, CNTRL)
!DEC$ATTRIBUTES ALIAS:“_mfLib_U2DREL”::mfLib_U2DREL
INTEGER SUCCESS [REFERENCE]
INTEGER IPRN [REFERENCE]
INTEGER II [REFERENCE]
INTEGER JJ [REFERENCE]
DIMENSION A ()
CHARACTER
200 CNTRL [REFERENCE]
END SUBROUTINE mfLib_U2DREL
END INTERFACE

Can some one point me to a resource on how to do this correctly?

Hi alanlemon,

Our Windows product supports some of CVF directives, so you should only need to change a few things. For the alias name, we append function names with an underscore instead of perpending them, so changing “mfLib_U2DREL" to "mfLib_U2DREL” should work.

Although we don’t support the “[REFERENCE]” syntax, we do support the reference attribute. Please remove the “[REFERENCE]” and add the following for each variable:
!DEC$ ATTRIBUTES REFERENCE ::

However, I’m not entirely sure adding a reference attribute is actually necessary since all variables in Fortran are passed by reference.

Note that full documentation on use of Windows directives can be found in Chapter 7 of the PGI users guide (PGI version 20.4 Documentation for x86 and NVIDIA Processors ).

Hope this helps,
Mat