C Interoperability on Windows -- or __cdecl, __stdcall, __fastcall

Tim Prince tprince@myrealbox.com
Wed Aug 8 12:45:00 GMT 2007


Tobias Burnus wrote:
> Hi all,
>
> on the GNU-Fortran@googlegroups list (gfortran user list) there was the
> question how to access the Windows' ABI function from Fortran.
>
> Using the ISO C Bindings helps in principle, but Windows has another
> speciality: It uses the __stdcall calling conventions whereas gfortran
> uses the __cdecl, calling convention. Cf. 
> http://www.codeproject.com/cpp/calling_conventions_demystified.asp
>
> The question is now: How to tell the compiler to generate a call to a  C
> function using this special calling convention?
>   
It's difficult enough to get interoperability between gfortran and 
current Windows ABI.  Do you intend to tackle also the ABI which was 
obsoleted 5 years ago?  CVF (and probably other compilers) had modified 
versions of stdcall ABI, and ifort 32-bit still has an option to attempt 
compatibility.  Among possible reasons for the modifications of stdcall 
were the lack of support for Fortran character variables.  Microsoft 
dropped stdcall when 64-bit support began.



More information about the Fortran mailing list