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

Tobias Burnus burnus@net-b.de
Tue Aug 7 19:25:00 GMT 2007


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?


Lahey seemingly has a "DLL_IMPORT FunctionName" statement, one could
also enhance BIND(c [, name=...]) by a
"callingconvention="[cdecl,stdcall,fastcall]", or ?

What do you think?

Tobias,
who does not have much Windows programming experience.



More information about the Fortran mailing list