Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

Calling fortran from C

Amrin_Fathima
Beginner
411 Views
Could you please suggest some good tutorial,which suggests on how to call fortran from C.

I have already implemented using GCC and GFORTRAN compiler.But when I try to run on windows,it shoes undefined reference for fortran subroutine.

I am using Intel compiler version 10.1

I need some quick solution without changing anything in my sourcecode.
0 Kudos
1 Reply
Steven_L_Intel1
Employee
411 Views
You haven't provided much detail, such as the declarations of the routines and the error messages. You are probably running into a difference in how external names are generated. On Windows, for Intel Fortran, names are upcased and there is no trailing underscore. On Linux, the usual convention is to downcase names and add a trailing underscore. If your C code assumes Linux conventions, it won't work by default on Windows.

Given the lack of data, I will guess that if you add /names:lowercase that you'll get closer to what you want. You may need to add /assume:underscore as well, depending on how the C code was written. Ideally, you would use the C interoperability features of Fortran 2003, which were implemented (not without bugs) in version 10.1. (Why are you using such an old Fortran? Are you also using a gcc and gfortran from 2009?)

You asked for a tutorial but also said you didn't want to change your code. Sorry, but these are contradictory. There's a "right way" to do this, but if you're getting link errors, you've done it the wrong way.
0 Kudos
Reply