program ch3_2 implicit none integer ,parameter :: number_of_people = 10 real :: total_weight=0.0, average_weight=0.0,total_height=0.0, average_height=0.0 integer :: person real , dimension(1:number_of_people) :: weight, height, BMI do person = 1, number_of_people print *,'type in...
使用—xtypemap=integer:64 指定该编译器的 8 字节 INTEGER。 3.4.48 –inline=[ %auto][[,][no%] f1,…[no%]fn] 启用或禁用指定例程的内联。 请求优化器对出现在函数和子例程名称列表(用逗号分隔)中的用户编写例程进行内联。在例程名之前加上 no% 可禁用对该例程的内联。 内联是一种优化方法,编译器...
标准数值序列类型是包含SEQUENCE语句以及唯一的缺省组件数据类型(INTEGER、REAL、DOUBLEPRECISION和COMPLEX,不带KIND=或*size)的派生类型。任何其他类型(如REAL*8)将使类型成为非标准类型。 例如,-aligncommon=4会将自然对齐方式为 4 字节或大于 4 字节的数据元素与 4 字节边界对齐。 该选项不影响自然对齐方式小于指定...
方法1Subroutinefun1(a)Reala(*)a(1:6)=1End Subroutine fun1!方法2Subroutinefun2(a,m,n)Integer m,n Reala(m,n)a=2End Subroutine fun2!方法3Subroutinefun3(a)Reala(:,:)a=3End Subroutine fun3 执行结果: 三种方法的形参数组,第一种称假定大小数组(assumed-size arrays),第二种称自动数组(auto ...
integer(4) jd real(8) js call MOMENT_NEW(4) jd = AFUNC() js = BFUNC(.TRUE.) write(*,*) jd, jsend 例2: 使用字符串 1. C++ 动态库结构 (1)头文件 externdouble__stdcall BFUNC(char* str); (2)实现 doubleBFUNC(char* str) ...
Procedure Pointer,直译大概是过程指针,我这里采用c语言的类似的概念称呼它:函数指针。 定义函数指针 定义函数指针首先需要定义抽象接口 module test_pp_define use iso_fortran_env implicit none abstract interface function binary_op_dp(x, y) result(ans) import :: real64 real(real64), intent(in) :: x...
例如函数 void cCharFunction( char *msg );需要定义成:void cCharFunction( char *msg , int len ); 经过上面的define之后,在Fortran中,只需调用CCHARFUNCTION( MSG )即可。由于Fortran程序没有明显得字符串结束标志,这样,如果两个字符串连在一起的话,C的程序里就会取到这个连在一起的字符串,因此,最好在...
两个冒号表示描述结束,比如 real, parameter :: pi=3.14159如果没有冒号则只能声明不能赋值,如 integer i,j,k另外定义数组比较巧妙的用法,如 integer :: a(5)=5 这
!!--Makefile---!!Runs the codewithvarious compilers.SHELL=bashFC=NO_COMPILER_SPECIFIEDCOMPILERS=gfortran-7gfortran-8ifortPR=@echo$(n)pr-m-t-w100define n endefall:rm-rf*.mod*.bin$(foreachFC,$(COMPILERS),$(n)\ rm-rf*.mod&&\$(FC)destructor.f90-o$(FC).bin&&\ chmod+x$(FC).bin...
integer::t integer::i real*8,dimension(t)::tem real*8::summ=0.00 doi=1,t summ=summ+tem(i) enddo aver=summ/real(t) return endfunctionaver !Takeminimum realfunctionminm(tem,t) implicitnone integer::t integer::i real*8,dimension(t)::tem minm=tem(1) doi=2,t if(minm>=tem(i)...