Use of tailing Clong arguments in ccall

There seems to be sometimes tailing Clong arguments in ccall in stdlib. Take LinearAlgebra/src/lapack.jl for example, there are functions like:

function gebak!(job::AbstractChar, side::AbstractChar,
                ilo::BlasInt, ihi::BlasInt, scale::AbstractVector{$relty},
                V::AbstractMatrix{$elty})
    require_one_based_indexing(scale, V)
    chkstride1(scale, V)
    chkside(side)
    chkfinite(V) # balancing routines don't support NaNs and Infs
    n = checksquare(V)
    info = Ref{BlasInt}()
    ccall((@blasfunc($gebak), liblapack), Cvoid,
            (Ref{UInt8}, Ref{UInt8}, Ref{BlasInt}, Ref{BlasInt}, Ref{BlasInt},
            Ptr{$relty}, Ref{BlasInt}, Ptr{$elty}, Ref{BlasInt}, Ptr{BlasInt},
            Clong, Clong),
            job, side, size(V,1), ilo, ihi, scale, n, V, max(1,stride(V,2)), info,
            1, 1)
    chklapackerror(info[])
    V
end

According to lapack documentation, there are only 10 arguments, without the final two Clongs.
But not every ccall need this. For example, gbtrf! doesn’t have tailing Clongs.
So what’s the use of these Clongs, and when should I add them when writing custom ccalls? I’m trying to write a wrapper for ILAENV, and I cannot decide whether I should add them.

They are length specifiers for character args in Fortran routines.
This Julia issue has details and references.

1 Like