# Use of tailing Clong arguments in ccall

**URL:** <https://discourse.julialang.org/t/use-of-tailing-clong-arguments-in-ccall/87682>\
**Category:** General Usage\
**Created:** [September 23, 2022, 2:07am UTC](https://discourse.julialang.org/t/use-of-tailing-clong-arguments-in-ccall/87682 "2022-09-23T02:07:39Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![jsjie](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jsjie/32/22477_2.png) [@jsjie](https://discourse.julialang.org/u/jsjie)\
**Post date:** [September 23, 2022, 2:07am UTC](https://discourse.julialang.org/t/use-of-tailing-clong-arguments-in-ccall/87682/1 "2022-09-23T02:07:39Z")

</div>

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

```julia
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](https://netlib.org/lapack/explore-html/dd/d9a/group__double_g_ecomputational_ga486d8da01d3304d595dab4cef3353ce6.html), 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.

---

<div class="post-metadata">

**Author:** ![Ralph\_Smith](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ralph_smith/32/10344_2.png) [@Ralph\_Smith](https://discourse.julialang.org/u/Ralph_Smith)\
**Post date:** [September 23, 2022, 1:41pm UTC](https://discourse.julialang.org/t/use-of-tailing-clong-arguments-in-ccall/87682/2 "2022-09-23T13:41:45Z")

</div>

They are length specifiers for character args in Fortran routines.  
[This Julia issue](https://github.com/JuliaLang/julia/issues/32870) has details and references.
