I wrote a ccall function, which returns a struct.
The function I wrote is
ccall((:BinghamSample, "libbingsam.so"),bingham_t,( Cdouble, Cdouble, Cdouble, Cint), 0, 0, 0, 10)
struct bingham_stats_t
dF::Ptr{Cdouble}
entropy::Cdouble
mode::Ptr{Cdouble}
scatter::Ptr{Ptr{Cdouble}}
end
struct bingham_t
d::Cint
V::Ptr{Ptr{Cdouble}}
Z::Ptr{Cdouble}
F::Cdouble
stats::Ptr{bingham_stats_t}
end
and my output looks like this
bingham_t(4, Ptr{Ptr{Float64}} @0x00000000046a7010, Ptr{Float64} @0x00000000047693f0, 19.73921, Ptr{bingham_stats_t} @0x0000000000000000)
the C output for the same function looks like this
B->F = 19.739210
B->Z = [ 0.000000 0.000000 0.000000 ]
B->V[0] = [ 0.000000 1.000000 0.000000 0.000000 ]
B->V[1] = [ 0.000000 0.000000 1.000000 0.000000 ]
B->V[2] = [ 0.000000 0.000000 0.000000 1.000000 ]
How do i retrieve the value of Z and V which is a vector and Array. unsafe_load doesn’t work.