From: Hifi-Comp on
I have program which contains a dll. The dll is composed of multiple
files with many subroutines and functions. Some arguments passed to
and from the dll is shared by most of the subroutines and functions
inside the dll. I want to know what is the best way to pass these
shared arguments without repeatedly declaring these arguments as shown
in the following example.

For example
Program Test
integer::a,b,c
real::d,e,f
CALL test_dll(a,b,c,d,e,f)
end program

subroutine test_dll(a,b,c,d,e,f)
integer,intent(in)::a,b,c
real,intent(out)::d,e,f
call test_sub1(a,b,c,d,e)
call test_sub2(a,b,c,d,e,f)
f=test_sub3(a,b,c,d,e)
end
subroutine test_sub1(a,b,c,d,e)
integer::INTENT(IN)::A,b,c
REAL::INTENT(OUT):;d,e
some statements
end

subroutine test_sub2(a,b,c,d,e,f)
integer::INTENT(IN)::A,b,c
REAL::INTENT(OUT):;d,e,f
some statements
end

function test_sub3(a,b,c,d,e)
integer::INTENT(IN)::A,b,c
REAL::d,e,test_sub3

some statements
end

From: steve on
On Jul 18, 7:44 pm, Hifi-Comp <wenbinyu.hea...(a)gmail.com> wrote:
> I have program which contains a dll. The dll is composed of multiple
> files with many subroutines and functions. Some arguments passed to
> and from the dll is shared by most of the subroutines and functions
> inside the dll. I want to know what is the best way to pass these
> shared arguments without repeatedly declaring these arguments as shown
> in the following example.
>
> For example
> Program Test
> integer::a,b,c
> real::d,e,f
> CALL test_dll(a,b,c,d,e,f)
> end program
>
> subroutine test_dll(a,b,c,d,e,f)
> integer,intent(in)::a,b,c
> real,intent(out)::d,e,f
> call test_sub1(a,b,c,d,e)
> call test_sub2(a,b,c,d,e,f)
> f=test_sub3(a,b,c,d,e)
> end
> subroutine test_sub1(a,b,c,d,e)
> integer::INTENT(IN)::A,b,c
> REAL::INTENT(OUT):;d,e
> some statements
> end
>
> subroutine test_sub2(a,b,c,d,e,f)
> integer::INTENT(IN)::A,b,c
> REAL::INTENT(OUT):;d,e,f
> some statements
> end
>
> function test_sub3(a,b,c,d,e)
> integer::INTENT(IN)::A,b,c
> REAL::d,e,test_sub3
>
> some statements
> end