------- Comment #9 from Lulin dot Song at gmail dot com 2010-09-01 14:22 ------- (In reply to comment #8) > (In reply to comment #0) > > Main program is written in C. (see the following) > > I strongly suggest using the C Binding facility of Fortran 2003 instead of > relying on the internals of a given compiler. GCC/gfortran supports the C > binding since 4.3.0 and newer version of most other compilers support it as > well. > > Cf. http://gcc.gnu.org/onlinedocs/gfortran/Interoperability-with-C.html > > The article at > http://www.fortranplus.co.uk/resource/fortran_2003_2008_compiler_support.pdf > lists for some compilers the support of Fortran 2003 (and 2008) features; > interesting for you are the items "Interoperability with C". Note: The list is > incomplete as not all vendors have submitted their data.
Thank you all for the information and suggestions. Fortran2003 C Binding facility seems to be what we should do next. Our project is a large Fortran77,90,95 C mixing language software been developed for years. It is hard to make it work with three different compilers (Intel ifort, AbfSalford ftn95 and gfortran). > > Regarding GCC/gfortran 4.1: I have no idea why it worked for you, but the > calling convention of 4.1 was the same (I just checked). > It is mystery to me too. The small program I submitted here works if compiled with 4.1.2 . Another curious thought. When the return value is integer or double, the dump looks like requestdouble (real(kind=8) & rlat, real(kind=8) & rlng) when the return value is character string, is it more intuitive to be requestdouble ( real(kind=8) & rlat, real(kind=8) & rlng,character(kind=1)[1:16] & __result, integer(kind=4) .__result) instead of requestdouble (character(kind=1)[1:16] & __result, integer(kind=4) .__result , real(kind=8) & rlat, real(kind=8) & rlng) ? I mean the ".__result" appending to arguments list instead inserting before arguments list. Many thanks again. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45466