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

C++ / Fortran inter language ABI issues with older versions of GCC

adamhassellavtolt_co
588 Views
We have managed to get our code building and running on Ubuntu 10.10. The code uses both C++ compiled with GCC 4.5 and fortran compiled with the latest version of ifort. We may be required to support an older embedded linux platform with a version of GCC several years old (still awaiting specs from client). Unfortunately their software and hardware has been speced for military use so it can't be upgraded. My question is are we likely to face ABI issues building our application with the old version of GCC and linking it with libraries compiled with the latest version of ifort?
0 Kudos
2 Replies
mecej4
Honored Contributor III
588 Views
One would guess that the Fortran part of your software does not use the C-interoperability features of F2003, and that your code is all 32-bit. Were that not the case, you would have to operate under the basic restriction that every F200x compiler has a specified "companion C processor", and an old version of GCC is probably not the companion C processor for a current version of Intel Fortran.

In the absence of C-interoperability features in the Fortran code, the programmer has no choice but to be aware of the ABI of the Fortran compiler as well as that of the C compiler (with, perhaps, exceptions for toy examples). Likewise, the programmer would learn about those compiler options that make achieving binary compatibility easier.

Since your military specs restrict the ABI on the C side to that for GCC 4.5, the only variable is the ABI of Intel Fortran. As you can see from numerous Forum posts, there are a number of calling conventions that are commonly used and supported by IFort, including old conventions such as STDCALL.

You need to watch out for the presence of real type arguments and return values. In that case, are you restricted to x87, or do you use SSEn?
0 Kudos
TimP
Honored Contributor III
588 Views
If your inter-language interface is all C compatible ("extern C" if in C++) you should not see changes in gcc affecting the interface at least since gcc 4.0.
It looks like you are facing specifications which go beyond what you can meet with casual assurances on this forum.
0 Kudos
Reply