I am trying to wrap the TBLIS library (https://github.com/devinamatthews/tblis). I have successfully worked with the `tblis_matrix`

types, but I am getting segmentation faults when trying to initialize `tblis_tensor`

types. Here is a self contained MRE, except for `libtblis.so`

which you can download for x86_64 linux from TBLIS.jl (https://github.com/mdav2/TBLIS.jl)

```
using Libdl
using LinearAlgebra
global tblis = dlopen("libtblis.so")
struct tblis_tensor{T}
type::Int32
conj::Int32
attr::ComplexF64
data::Array{T}
ndim::UInt32
len::Vector{Int}
stride::Vector{Int}
end
function tblis_tensor{T}(D) where T <: AbstractFloat
strides = [1]
lens = collect(size(D)) .+ 1
for (i,v) in enumerate(lens[1:end-1])
push!(strides,v*strides[i])
end
n::UInt32 = length(size(D))
M = tblis_tensor{T}(zero(Int32),zero(Int32),
0.0 + 0.0im,
D,
n,
Vector(lens),
Vector(strides))
if T == Float32
tblis_init_tensor = dlsym(tblis,:tblis_init_tensor_s)
elseif T == Float64
tblis_init_tensor = dlsym(tblis,:tblis_init_tensor_d)
else
error("Type $T is not supported by TBLIS :(")
end
ccall(tblis_init_tensor,Cvoid,(Ref{tblis_tensor{T}},Cuint,Ref{Int},Ref{T},
Ref{Int}),
Ref(M),n,lens,D,strides)
return M
end
mytensor = tblis_tensor{Float64}(rand(2,2))
println(mytensor)
```

I will note that the segfault does not actually occur in the ccall itself, but at the next GC step or if you try to print the `tblis_tensor`

object.