# How to retrive a data from Pointer

**URL:** <https://discourse.julialang.org/t/how-to-retrive-a-data-from-pointer/25815>\
**Category:** General Usage\
**Tags:** ccall\
**Created:** [June 28, 2019, 4:23pm UTC](https://discourse.julialang.org/t/how-to-retrive-a-data-from-pointer/25815 "2019-06-28T16:23:55Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![arunkumar04](https://avatars.discourse-cdn.com/v4/letter/a/71e660/32.png) [@arunkumar04](https://discourse.julialang.org/u/arunkumar04)\
**Post date:** [June 28, 2019, 4:23pm UTC](https://discourse.julialang.org/t/how-to-retrive-a-data-from-pointer/25815/1 "2019-06-28T16:23:55Z")

</div>

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)`

```julia
struct bingham_stats_t
    dF::Ptr{Cdouble}
    entropy::Cdouble
    mode::Ptr{Cdouble}
    scatter::Ptr{Ptr{Cdouble}}
end

```

```julia
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

```julia
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.

---

<div class="post-metadata">

**Author:** ![cchderrick](https://avatars.discourse-cdn.com/v4/letter/c/ecd19e/32.png) [@cchderrick](https://discourse.julialang.org/u/cchderrick)\
**Post date:** [June 28, 2019, 8:12pm UTC](https://discourse.julialang.org/t/how-to-retrive-a-data-from-pointer/25815/2 "2019-06-28T20:12:09Z")

</div>

Not an expert with `ccall`, but I think you can try [`unsafe_load`](https://docs.julialang.org/en/v1/base/c/#Base.unsafe_load)?
