zoukankan      html  css  js  c++  java
  • 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。

  • 相关阅读:
    50种方法优化SQL Server
    VS2015在Windows 10 下面安装经验
    python中yield的用法详解——最简单,最清晰的解释
    Mac安装Allure
    Python之pymysql数据库操作
    Python操作Excel神器-openpyxl之写入
    Python OS 模块处理路径
    Python操作Excel神器-openpyxl之读取
    Python中的if __name__ == '__main__'
    Python元组常用方法及汇总
  • 原文地址:https://www.cnblogs.com/gcczhongduan/p/5093443.html
Copyright © 2011-2022 走看看