Linking between Fortran and C

Linking between Fortran and C

I have run into the infamous double-underscore issue.

I have a library that is written in C and a program that must link with that library written in Fortran 90. The ifort compiler insists on trying to link using single underscore suffixes for the functions it is using from the C library. Originally I used gcc to compile the C library but it produced double underscores. I have tried to compile the C library using icc but I still get double underscores as symbols. Any ideas how I can get ifort to link with double underscores or get icc to not create double underscores?

Thank you,

2 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

C compilers don't append the double underscores through any built-in mechanism. Usually, there are #define macros to be adjusted so that a single underscore is appended. Many applications have a configure script, or a documented macro, for this purpose. The single underscore convention used by Intel Fortran is much the same as f2c originally used, and was adopted by several vendors.

Leave a Comment

Please sign in to add a comment. Not a member? Join today