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 Clong
s.
But not every ccall need this. For example, gbtrf!
doesn’t have tailing Clong
s.
So what’s the use of these Clong
s, and when should I add them when writing custom ccall
s? I’m trying to write a wrapper for ILAENV, and I cannot decide whether I should add them.