fortran 函数的调用标准

Fortran函数的调用标准在编译时使用iface声明,如iface:default,表示采用的是default标准。
fortran的调用标准有
[1] default: Tells the compiler to use the default calling conventions.
[2] cref: Tells the compiler to use calling conventions C, REFERENCE.
[3] cvf:Tells the compiler to use calling convention CVF.
[4] [no]mixed_str_len_arg Determines the argument-passing convention for hidden-length character arguments.
[5] stdcall Tells the compiler to use calling convention STDCALL.
[6] stdref Tells the compiler to use calling conventions STDCALL, REFERENCE.

这里我介绍一下我遇到的default和mixed_str_len_arg标准对函数调用中的character类型的影响,
fortran 中的character类型相当于c语言中的char[] ,在函数调用中使用character参数,编译器会默认
地为该参数添加一个长度的参数,
如 character(len=10) name
interger catet
call fortran_fun(name,catet)
此时,实际传入的参数有3个:name , len(name),catet
如果使用default调用标准,在参数压栈时会将其len(name)最后压入,(如有多个character参数,则在最后按顺序压入)
而使用mixed_str_len_arg调用标准时,在参数压栈时,会将len(name)紧跟在name后面压人栈中
所以如果调用函数与函数有不同的调用标准时,就会出现mismatch。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值