Software Archive
Read-only legacy content
17061 Discussions

Mixed-Language Programming with C++

Intel_C_Intel
Employee
409 Views
In earlier versions of Microsoft Fortran I could use the INTERFACE TO statement for global scope. My project contains more than 2.500 fortran files! So I added in each file the first line with an INCLUDE of the mixed language declaration file. This include file contains sections like

INTERFACE TO INTEGER FUNCTION HATGEN [STDCALL](A,B,C,D,E)
INTEGER A,D,E
INTEGER B [REFERENCE]
DOUBLEPRECISION C [REFERENCE]
END

The documentation of Visual Fortran 6.5 says, the new syntax is

INTERFACE
INTEGER FUNCTION HATGEN(A,B,C,D,E)
!DEC$ ATTRIBUTES STDCALL :: HATGEN
!DEC$ ATTRIBUTES REFERENCE :: B,C
INTEGER A,B,D,E
DOUBLEPRECISION C
END FUNCTION
END INTERFACE

But this only work, if the interface is embedded inside of a subroutine or function definition. Is the necessary interface declaration for mixed language routines only possible for local scope?
I need it for global scope, because otherwise I have explicitly to insert some thousand interface sections!
Who can help me??
Sorry for my german english.

Burkhard
0 Kudos
3 Replies
Steven_L_Intel1
Employee
409 Views
Sorry - Visual Fortran does not support "global scope" for INTERFACE TO. You can put the INTERFACE TO lines in a MODULE and just add a USE of the module name to your routines.

Steve
0 Kudos
Jugoslav_Dujic
Valued Contributor II
409 Views
INCLUDE will work equally well as USE, but again it
has to be used in every subroutine which calls a C function,
not on beginning of source files.

Unfortunately, this is
an example how a non-portable extension may strike back
hardly. Fortran had never had "file scope" of names, so
the MS's extension was a bit stretching... and abandoned.

Perhaps a "Replace in files" utility (you can download
"File Search Replace Utility" from www.gamadyne.com) might help you to
automate the task on 2.500 source files... or a well-written macro
in Visual Studio.

Jugoslav
0 Kudos
durisinm
Novice
409 Views
There used to be a utility program, STRSUB.EXE, that was distributed with F. If you have it, it will be found at . This utility replaces all occurrences of a string with another string within a file. You might be able to write a batch file or a macro using this utility to help you modify your files without having to do it manually.

Mike Durisin
0 Kudos
Reply