calling convention

Nuno Pedrosa nunomdp@gmail.com
Wed Dec 4 23:08:00 GMT 2013


Hi Tobias,

Thank you for your very informative comments

On 29/11/13 21:23, Tobias Burnus wrote:
> Regarding cdecl, stdcall and fastcall: gfortran has directives to
> choose which one to use on a per-procedure basis.
>
This is very good to know when writing future code. I do not think it is
feasible to do it on the existent code base.
>> My question is: are there any plans to include such compiler options in
>> gfortran, if not can anybody point me in the right direction on which
>> gfortran source files to check if this can be done?
>
> Having compiler options causes one problem: For instance, if you
> change the calling conventions with one flag, you affect all
> procedures in that file. But typically, you only want to affect some
> as it is not uncommon that one needs different conventions in the same
> code. Additionally, you potentially also affect calls to the run-time
> library, which one would have to save guard.
>
I agree with you and here what I think the likes of intel have done is
have all versions of the function with different calling conventions in
the same runtime library.

> At the same time, there is a convergence towards cdecl (also 64bit
> Windows moves there) and the need to interop with older code with
> different conventions [except for -ff2c] seems to be also going down. 
Again I agree with you.
>
> Hence, I don't think that any flag-based solution will be implemented.
>
For the moment I think the best option is to create C++ wrappers to call
the gfortran functions. or wrap C functions that can be called from Fortran.

Nuno



More information about the Fortran mailing list