[REFERENCE]标签在参数声明中做什么? [英] What does the [REFERENCE] tag do in an argument declaration?

查看:117
本文介绍了[REFERENCE]标签在参数声明中做什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在Fortran中为某个软件编写自定义回调函数(例如

I am writing an custom callback function in Fortran for a piece of software (example here) that includes the following argument declaration

SUBROUTINE CONTACT_FORCE(TIME,UPAR,NPAR,PEN,RVEL,JFLAG,IFLAG,RESULT)
!DEC$ ATTRIBUTES DLLEXPORT,C::CONTACT_FORCE
...
DOUBLE PRECISION RESULT[REFERENCE](6)   !Compiles ok

使用Compaq Visual Fortran 6可以很好地编译.因此,我的问题是[REFERENCE]标记的作用是什么?我认为Fortran 通过引用传递所有内容(而不是按值).当然,编译器对此没有任何帮助,并且在线搜索非常困难,因为参考单词一词在Fortran中使用过多,我不知道如何缩小它的范围.

Which compiles fine with Compaq Visual Fortran 6. So my question is what does the [REFERENCE] tag do? I thought that Fortran passes everything by reference (and not by value). Of course there nothing in the compiler help about this, and searching online is difficult because the word reference is used so much with respect to Fortran that I don't know how to narrow it down.

编辑,以上内容必须与

SUBROUTINE CONTACT_FORCE(TIME,UPAR,NPAR,PEN,RVEL,JFLAG,IFLAG,RESULT)
!DEC$ ATTRIBUTES DLLEXPORT,C::CONTACT_FORCE
!DEC$ ATTRIBUTES REFERENCE::RESULT
...
DOUBLE PRECISION RESULT(6)   !Compiles ok

推荐答案

我在这里假设MS产品.如果使用CSTDCALL属性,则可以使Fortran通过值或通过引用传递.看到这里:

I'm assuming MS products here. Fortran can be made to pass by value or by reference if the C or STDCALL attribute is used. See here:

http://msdn.microsoft.com /en-us/library/aa294334(v=vs.60).aspx

这篇关于[REFERENCE]标签在参数声明中做什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆