Quantcast
Channel: Intel® Fortran Compiler
Viewing all articles
Browse latest Browse all 3270

How to call Fortran routine in static library using C

$
0
0

What is the proper calling convention for a C routine to call a Fortran subroutine containing a character variable in the call list.

Example C code:
...
char *strng[1];
fsubr(strng[0]);
...

Example Fortran code:
SUBROUTINE FSUBR(strng)
!DEC$ ATTRIBUTES DECORATE, ALIAS:'fsubr' :: FSUBR
...
CHARACTER*(*) STRNG
...

Using the default calling convention for the Fortran code and __cdecl for the C code I end up with STRNG having an undefined address when I step into the Fortran routine.

Regards, Mike


Viewing all articles
Browse latest Browse all 3270

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>