Dummy argument associated actual procedure differs from dummy argument of the dummy procedure

Viewed 471

I'm using a the function NEQNF from the IMSL Fortran Library to solve a non-linear equation system and get 3 errors. I'm using Visual Studio 2017 on a x64 system. The error says the following:

Error #7061: The characterístic of dummy argument 1 of the associated actual procedure differ from the characteristics of dummy argument 1 of the dummy procedure [FCN_SS]


Error #7062: The characterístic of dummy argument 2 of the associated actual procedure differ from the characteristics of dummy argument 2 of the dummy procedure [FCN_SS]

Error #7063: The characterístic of dummy argument 3 of the associated actual procedure differ from the characteristics of dummy argument 3 of the dummy procedure [FCN_SS]

The code is:

    include 'link_fnl_shared.h' 

    use neqnf_int
    use umach_int

    implicit none

!Declaring variables
    .
    .
    .

    Contains

    subroutine solve_ss(x, fnorm)

        integer n
        parameter (n=2)

        integer k, nout
        real(dp) :: fnorm, x(n), xguess(n)

        data xguess/1.0_dp, 0.3_dp/   !guess for total output in units

        call umach (2, nout)
        call neqnf (fcn_ss, x, xguess=xguess, fnorm=fnorm)

    end subroutine solve_ss


    subroutine fcn_ss(x, f, n)

        implicit none

        !specification
        integer n
        real(dp) :: x(n), f(n)

    .
    .
    .

    F(1)=...

    F(2)=...

    end subroutine fcn_ss

I'm not sure what the error is about, since the declaration of the variables is the same in solve_ss and fcn_ss.

1 Answers

The documentation of the library explicitly states (here and here) that you are required to use the respective modules in order to have access to modern implementation of the routines.

Otherwise, you may be (I can't test, but I'm basing on this) accessing legacy support of the library. So, instead of the generic Fortran 90 interface, It may be leading you to the FORTRAN77 specific interface:

NEQNF (FCN, ERRREL, N, ITMAX, XGUESS, X, FNORM)

Other detail is that the documentation explicity states you must declare the passed function as external:

external fcn_ss

Still, I'm not sure about those guesses. Could be that or any other strange error. Please provide feedback.

Related