Standardized mixed language programming for Fortran and C

B. Einarsson, R. Hanson, T. Hopkins
{"title":"Standardized mixed language programming for Fortran and C","authors":"B. Einarsson, R. Hanson, T. Hopkins","doi":"10.1145/1667140.1667142","DOIUrl":null,"url":null,"abstract":"Programmers have long practiced the matter of mixed language procedure calls. This is particularly true for the programming languages C and Fortran. The use of the alternate language often results in efficient running time or the effective use of human or other resources.\n Prior to the Fortran 2003 standard there was silence about how the two languages interoperated. Before this release there existed a set of differing ad hoc methods for making the inter-language calls. These typically depended on the Fortran and C compilers. The newer Fortran standard provides an intrinsic module, iso_c_binding, that permits the languages to interoperate. There remain restrictions regarding interoperable data types.\n This paper illustrates several programs that contain core exercises likely to be encountered by programmers. The source code is available from the first author's web site. Included is an illustration of a \"trap\" based on use of the ad hoc methods: A call from a C to a Fortran 2003 routine that passes a character in C to a character variable in Fortran results in a run-time error.","PeriodicalId":379614,"journal":{"name":"ACM SIGPLAN Fortran Forum","volume":"17 1","pages":"0"},"PeriodicalIF":0.0000,"publicationDate":"2009-12-04","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":"2","resultStr":null,"platform":"Semanticscholar","paperid":null,"PeriodicalName":"ACM SIGPLAN Fortran Forum","FirstCategoryId":"1085","ListUrlMain":"https://doi.org/10.1145/1667140.1667142","RegionNum":0,"RegionCategory":null,"ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":null,"EPubDate":"","PubModel":"","JCR":"","JCRName":"","Score":null,"Total":0}
引用次数: 2

Abstract

Programmers have long practiced the matter of mixed language procedure calls. This is particularly true for the programming languages C and Fortran. The use of the alternate language often results in efficient running time or the effective use of human or other resources. Prior to the Fortran 2003 standard there was silence about how the two languages interoperated. Before this release there existed a set of differing ad hoc methods for making the inter-language calls. These typically depended on the Fortran and C compilers. The newer Fortran standard provides an intrinsic module, iso_c_binding, that permits the languages to interoperate. There remain restrictions regarding interoperable data types. This paper illustrates several programs that contain core exercises likely to be encountered by programmers. The source code is available from the first author's web site. Included is an illustration of a "trap" based on use of the ad hoc methods: A call from a C to a Fortran 2003 routine that passes a character in C to a character variable in Fortran results in a run-time error.
标准的Fortran和C混合语言编程
程序员长期以来一直在实践混合语言过程调用的问题。对于编程语言C和Fortran来说尤其如此。使用替代语言通常会导致高效的运行时间或有效地利用人力或其他资源。在Fortran 2003标准之前,对于这两种语言如何互操作一直保持沉默。在此版本之前,存在一组不同的用于进行语言间调用的特殊方法。这些通常依赖于Fortran和C编译器。较新的Fortran标准提供了一个内部模块iso_c_binding,它允许两种语言进行互操作。关于可互操作的数据类型仍然存在限制。本文举例说明了几个包含程序员可能遇到的核心练习的程序。源代码可从第一作者的网站获得。下面是一个基于特殊方法使用的“陷阱”的示例:从C调用Fortran 2003例程,将C中的字符传递给Fortran中的字符变量,将导致运行时错误。
本文章由计算机程序翻译,如有差异,请以英文原文为准。
求助全文
约1分钟内获得全文 求助全文
来源期刊
自引率
0.00%
发文量
0
×
引用
GB/T 7714-2015
复制
MLA
复制
APA
复制
导出至
BibTeX EndNote RefMan NoteFirst NoteExpress
×
提示
您的信息不完整,为了账户安全,请先补充。
现在去补充
×
提示
您因"违规操作"
具体请查看互助需知
我知道了
×
提示
确定
请完成安全验证×
copy
已复制链接
快去分享给好友吧!
我知道了
右上角分享
点击右上角分享
0
联系我们:info@booksci.cn Book学术提供免费学术资源搜索服务,方便国内外学者检索中英文文献。致力于提供最便捷和优质的服务体验。 Copyright © 2023 布克学术 All rights reserved.
京ICP备2023020795号-1
ghs 京公网安备 11010802042870号
Book学术文献互助
Book学术文献互助群
群 号:481959085
Book学术官方微信