# Pointer (Julia) not modified after ccall to C function which uses another C function

**URL:** <https://discourse.julialang.org/t/pointer-julia-not-modified-after-ccall-to-c-function-which-uses-another-c-function/10455>\
**Category:** General Usage\
**Tags:** ccall\
**Created:** [April 20, 2018, 1:13pm UTC](https://discourse.julialang.org/t/pointer-julia-not-modified-after-ccall-to-c-function-which-uses-another-c-function/10455 "2018-04-20T13:13:46Z")\
**Posts on this page:** 1\
**Showing post:** 13

<div class="post-metadata">

**Author:** ![yuyichao](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/yuyichao/32/20_2.png) [@yuyichao](https://discourse.julialang.org/u/yuyichao)\
**Post date:** [April 20, 2018, 6:04pm UTC](https://discourse.julialang.org/t/pointer-julia-not-modified-after-ccall-to-c-function-which-uses-another-c-function/10455/13 "2018-04-20T18:04:02Z")

</div>

> [@pedrohnv](#):
>
> ccall((“foo”, “./shared.so”), Int, (Ref{Mystruct},), mystruct);  
> ccall((“foo”, “./shared.so”), Int, (Mystruct,), mystruct);

Both are undefined behavior basically. Julia array are not just a pointer.

> [@jlapeyre](#):
>
> It looks like a pointer is only acquired when needed, via pointer\_from\_objref.

That’s right, and that’s why I said it’s not any different from C. In julia, there’s also an user accessible address for EVERY objects. It may not be stable and all pointer stuff are “unsafe” but that’s still a well defined language semantics. Depending on what you are doing with the object, e.g. taking it’s address, passing it to a different function, etc, there are very different optimizations that can be done on them, including if the object is allocated on heap/stack/register.

---

_[View the full topic](https://discourse.julialang.org/t/pointer-julia-not-modified-after-ccall-to-c-function-which-uses-another-c-function/10455)._
