C++ / Fortran inter language ABI issues with older versions of GCC
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 ca开发者_JAVA百科n't be upgraded. My question is are we likely to face ABI issues building our application with the older version of GCC and linking it with libraries compiled with the latest version of ifort?
Are you trying to call the Fortran code from C++, call the C++ code from Fortran, or both? If you're calling Fortran code from C++, I don't think you'll have a problem, especially if you're using the same Fortran compiler.
If you're trying to access C++ code from Fortran, this will depend on the nature of the C++ code. If the Fortran-accessible functions use C linkage, then you should be okay, because the C ABI is standardized. If the functions use C++ linkage, I would expect to have some trouble, because the C++ ABI isn't standardized and I'm sure GCC has made minor (and possibly major) changes to their ABI over the years.
精彩评论