Page 10 - Demo
P. 10
Interface to FORTRAN%uf09f %uf09f RCP Consult 2023-2026 Page 10The second function shows using of global namesreal*8 function StoneCircularGN(ier) bind(C,name='StoneCircularGN') implicit none!! Include file with internal STRUREL definitionsinclude 'strurel.hf'!GCC$ ATTRIBUTES DLLEXPORT::StoneCircularGNinteger, intent(out) :: ier!# Uses global names of Variables and Parameters to access their values.!# The sequence is arbitrary. STRUREL is case sensitive but FORTRAN not.StoneCircularGN = PAR1*DACOS(-1.D0)/4*Strength*Diameter**2-PAR2*Loadier=0end functionThe third function shows usage of formal argumentsreal*8 function StoneCircularFA(l,s,d,p1,p2,pi,ier) bind(C,name='StoneCircularFA') implicit none!GCC$ ATTRIBUTES DLLEXPORT::StoneCircularFAdouble precision, intent(in), value :: l, s, d, p1, p2, piinteger, intent(out) :: ier!# Uses function argument values as defined in Symbolic Expressions.!# The sequence is predefined by definition of parameters in DEFFUNC.StoneCircularFA = p1*pi/4*s*d**2 - p2*lier=0end functionIn this case an include file %u2018strurel.hf%u2019 can be omitted because all data will be processed asinput parameters.It is also allowed to use a mixed mode %u2013 global vector, global names and arguments in the same export function. For this kind you always must include %u2018strurel.hf%u2019.Note: Function and argument names are arbitrary.

