SHARED option in OPEN Statement in the Fortran sta

2020-04-30 11:01发布

In this documentation HP Fortran doc, the OPEN statement accept SHARED and READONLY options.
In this documentation Standard Fortran 2008 doc, the OPEN statement dosn't accept SHARED or READONLY options.
Since I'm using gfortran comes with gcc 4.4.7 to compile a Fortran source file on Linux,I used a ruse to get around half the problem. I used

 OPEN(...,ACTION=READ,...)  instead of READONLY.

But can't find an other ruse (:)) to replace SHARED Option. (Like Something=Shared).
Anyone have a ruse to get arround that?

1条回答
别忘想泡老子
2楼-- · 2020-04-30 11:27

Those IO extensions (SHARED, READONLY, etc) as well as other extensions, as would be available with DEC based Fortran should be available in GCC/gFortran via the "-fdec" and related compiler switches.

However, I found some confusion in the online GCC docs. Apparently, some older versions of gFortran (and in particular g77) may require the compiler to have been built with the libf2c element, and there may be differences on Unix (c.f. Win etc).

It is not clear exactly which versions of gFortran accept this. For example, under Windows, with GCC/gFortran 6.x, it would not recognise the "-fdec" switch.

Apparently, GCC/gFortran v7.x have all that working, but v7 is still in "development mode" ... are you feeling lucky :-) ?

Also, some references give dire warnings about reliance on "extensions".

Here are some pages of interest:

https://gcc.gnu.org/wiki/GFortran/News

https://gcc.gnu.org/onlinedocs/gfortran/Extended-I_002fO-specifiers.html

https://gcc.gnu.org/onlinedocs/gfortran/Option-Summary.html

https://gcc.gnu.org/onlinedocs/gfortran/Fortran-Dialect-Options.html

The last link seems particularly "dire" on the subject.

查看更多
登录 后发表回答