# Help with ccall to a clib function

**URL:** <https://discourse.julialang.org/t/help-with-ccall-to-a-clib-function/5747>\
**Category:** General Usage\
**Created:** [September 6, 2017, 6:23pm UTC](https://discourse.julialang.org/t/help-with-ccall-to-a-clib-function/5747 "2017-09-06T18:23:56Z")\
**Posts on this page:** 1\
**Showing post:** 4

<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:** [September 7, 2017, 2:32am UTC](https://discourse.julialang.org/t/help-with-ccall-to-a-clib-function/5747/4 "2017-09-07T02:32:38Z")

</div>

> [@sdanisch](#):
>
> ptr = Base.unsafe\_convert(Ptr{cc\_t}, array ) # unsafe! make sure to keep a reference to array alive

Basically don’t call `unsafe_convert` manually like this. The code here is allowed to crash.

Also this appears to be duplicated at [Help with ccall to clib functions](https://discourse.julialang.org/t/help-with-ccall-to-clib-functions/5749) Note that this is not the correct way to declare inline array member (and note that C arrays are **NOT** pointer).

---

_[View the full topic](https://discourse.julialang.org/t/help-with-ccall-to-a-clib-function/5747)._
