请选择 进入手机版 | 继续访问电脑版

因斯福论坛

搜索
查看: 18097|回复: 0

Intel Fortran 编译器的 -Gm 选项

[复制链接]
发表于 2013-4-11 15:34:52 | 显示全部楼层 |阅读模式
在CHEMKIN的自带Fortran例子的makefile中,可以看到编译选项为 -Gm

#-Gm : Use compaq visual fortran interface

如果不使用 -Gm 选项,程序运行会崩溃。因为 CHEMKIN 的库是带 -Gm 编译的,所以用户的 Fortran 代码页必须采用同样的编译选项。

-Gm 相当于 /iface:cvf ,即采用 Compaq Visual Fortran 的调用约定。

详见:
http://software.intel.com/sites/products/documentation/hpc/composerxe/en-us/2011Update/fortran/win/copts/fortran_options/option_iface.htm

拷贝如下:

iface

Specifies the default calling convention and argument-passing convention for an application.
IDE Equivalent
Windows: External Procedures > Calling Convention (/iface:{cref|stdref|stdcall|cvf|default})
External Procedures > String Length Argument Passing (/iface:[no]mixed_str_len_arg)
Linux: None
Mac OS X: None
Architectures
IA-32, Intel® 64 architectures
Syntax
Linux and Mac OS X:
None

Windows:
/iface:keyword

Arguments
keyword
Specifies the calling convention or the argument-passing convention. Possible values are:
default Tells the compiler to use the default calling conventions.
crefTells the compiler to use calling conventions C, REFERENCE.
cvfTells the compiler to use calling conventions compatible with Compaq Visual Fortran*.
[no]mixed_str_len_argDetermines the argument-passing convention for hidden-length character arguments.
stdcallTells the compiler to use calling convention STDCALL.
stdrefTells the compiler to use calling conventions STDCALL, REFERENCE.

Default
/iface:default
The default calling convention is used.

Description
This option specifies the default calling convention and argument-passing convention for an application.
The aspects of calling and argument passing controlled by this option are as follows:


  • The calling mechanism (C or STDCALL): On IA-32 architecture, these mechanisms differ in how the stack register is adjusted when a procedure call returns. On Intel® 64 architecture, the only calling mechanism available is C; requests for the STDCALL mechanism are ignored.
  • The argument passing mechanism (by value or by reference)
  • Character-length argument passing (at the end of the argument list or after the argument address)
  • The case of external names (uppercase or lowercase)
  • The name decoration (prefix and suffix)

You can also use the ATTRIBUTES compiler directive to modify these conventions on an individual basis. Note that the effects of the ATTRIBUTES directive do not always match that of the iface option of the same name.
Option
Description
/iface:default
Tells the compiler to use the default calling conventions.
These conventions are as follows:
·         The calling mechanism: C
·         The argument passing mechanism: by reference
·         Character-length argument passing: at end of argument list
·         The external name case: uppercase
·         The name decoration: Underscore prefix on IA-32 architecture, no prefix on Intel® 64 architecture; no suffix
/iface:cref
Tells the compiler to use the same conventions as /iface:default except that external names are lowercase.
/iface:cvf
Tells the compiler to use calling conventions compatible with Compaq Visual Fortran* and Microsoft Fortran PowerStation.
These conventions are as follows:
·         The calling mechanism: STDCALL
·         The argument passing mechanism: by reference
·         Character-length argument passing: following the argument address
·         The external name case: uppercase
·         The name decoration: Underscore prefix on IA-32 architecture, no prefix on Intel® 64 architecture. On Windows* systems using IA-32 architecture, @n suffix where n is the number of bytes to be removed from the stack on exit from the procedure. No suffix on other systems.
/iface:mixed_str_len_arg
Specifies argument-passing conventions for hidden-length character arguments. This option tells the compiler that the hidden length passed for a character argument is to be placed immediately after its corresponding character argument in the argument list. This is the method used by Compaq Visual Fortran*. When porting mixed-language programs that pass character arguments, either this option must be specified correctly or the order of hidden length arguments must be changed in the source code. This option can be used in addition to other /iface options.
/iface:stdcall
Tells the compiler to use the following conventions:
·         The calling mechanism: STDCALL
·         The argument passing mechanism: by value
·         Character-length argument passing: at the end of the argument list
·         The external name case: uppercase
·         The name decoration: Underscore prefix on IA-32 architecture, no prefix on Intel® 64 architecture. On Windows* systems using IA-32 architecture, @n suffix where n is the number of bytes to be removed from the stack on exit from the procedure. No suffix on other systems.
/iface:stdref
Tells the compiler to use the same conventions as /iface:stdcall except that argument passing is by reference.

Caution
On Windows systems, if you specify option /iface:cref, it overrides the default for external names and causes them to be lowercase. It is as if you specified "!dec$ attributes c, reference" for the external name.
If you specify option /iface:cref and want external names to be uppercase, you must explicitly specify option /names:uppercase.
Caution
On systems using IA-32 architecture, there must be agreement between the calling program and the called procedure as to which calling mechanism (C or STDCALL) is used or unpredictable errors may occur. If you change the default mechanism to STDCALL, you must use the ATTRIBUTES DEFAULT directive to reset the calling conventions for routines specified with the USEROPEN keyword in an OPEN statement and for comparison routines passed to the QSORT library routine.
Alternate Options

/iface:cvf
Linux and Mac OS X: NoneWindows: /Gm
/iface:mixed_str_len_arg
Linux and Mac OS X: -mixed-str-len-argWindows: None
/iface:nomixed_str_len_arg
Linux and Mac OS X: -nomixed-str-len-argWindows: None
/iface:stdcall
Linux and Mac OS X: NoneWindows: /Gz


回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|因斯福论坛  

GMT+8, 2024-12-9 03:40

Powered by Discuz! X3.4

© 2001-2017 Comsenz Inc.

快速回复 返回顶部 返回列表