Using gfortran to build user functions

Rachel Elsey's picture


I've been gfortran to build simple user functions in a dll's (actually simple user functions which call complex functions in legacy fortran code)

At the moment I have created just the main step function such as a simple example below.

I have some complex things working really well and I have got a long way just using this.

subroutine test1(param, insig, outsig)
!* input(s): insig(1) = Input 1
!* insig(2) = Input 2
!* output(s): outsig(1) = Result
!* parameters: param(1) = Not Used
real*8 :: param(1), insig(2), outsig(2)
integer :: i
outsig(1) = (insig(1) + insig(2))/2.0
end subroutine

and built it with ...

gfortran -shared -fno-underscoring test1.f90 -o test1.dll

... and it works well.

However, when I add the further subroutines to the library e.g. test1SS to do some initialisation on the first step (at the moment I am passing in the step count as a parameter and using this to trigger initialisation) or try to create some parameters for the block I get stuck. It seems that although the functions are in the dll, VISSIM does not recognise them.

Does anyone have a working example in gfortran they can show me were they have done such things?

Best Regards


Hi Rachel, Please post the

Hi Rachel,
Please post the testSS function that is causing problems. It should work OK.

Rachel Elsey's picture

Hi Pete, Thanks very much

Hi Pete,

Thanks very much for your reply.

After messing around with it a bit more gave up and switched to writing the user functions in C and then calling the FORTRAN from these. It proved easier than I though it would as I could use the TANK32 as an example. So I have a working example now.