# Pass (to Julia) a C struct which contains a pointer to another struct

**URL:** <https://discourse.julialang.org/t/pass-to-julia-a-c-struct-which-contains-a-pointer-to-another-struct/44406>\
**Category:** General Usage\
**Tags:** array, struct\
**Created:** [August 6, 2020, 9:13am UTC](https://discourse.julialang.org/t/pass-to-julia-a-c-struct-which-contains-a-pointer-to-another-struct/44406 "2020-08-06T09:13:18Z")\
**Posts on this page:** 1\
**Showing post:** 2

<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:** [August 6, 2020, 1:27pm UTC](https://discourse.julialang.org/t/pass-to-julia-a-c-struct-which-contains-a-pointer-to-another-struct/44406/2 "2020-08-06T13:27:36Z")

</div>

And this is exactly why I recommend against it in [Passing a C struct into Julia](https://discourse.julialang.org/t/passing-a-c-struct-into-julia/43965) .

Unless you are completely familar with all the layout, you should use the C types to pass data around, rather than trying to create julia arrays etc. Even if you do, it’s still less efficient to create those julia types in C. (and you can create the necessary C layout compatible julia types using “native” C or generic julia C api and it’s much better to use the native one.)

And again, if you have a pointer in your C struct, use a pointer in your julia struct as well.

---

_[View the full topic](https://discourse.julialang.org/t/pass-to-julia-a-c-struct-which-contains-a-pointer-to-another-struct/44406)._
