# What is the correct way to create a "pointer to pointer"?

**URL:** <https://discourse.julialang.org/t/what-is-the-correct-way-to-create-a-pointer-to-pointer/71442>\
**Category:** General Usage\
**Tags:** question, ccall\
**Created:** [November 14, 2021, 1:01am UTC](https://discourse.julialang.org/t/what-is-the-correct-way-to-create-a-pointer-to-pointer/71442 "2021-11-14T01:01:09Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![carstenbauer](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/carstenbauer/32/4981_2.png) [@carstenbauer](https://discourse.julialang.org/u/carstenbauer)\
**Post date:** [November 14, 2021, 8:24am UTC](https://discourse.julialang.org/t/what-is-the-correct-way-to-create-a-pointer-to-pointer/71442/3 "2021-11-14T08:24:18Z")

</div>

FWIW, in [LIKWID.jl](https://github.com/JuliaPerf/LIKWID.jl) I had to wrap a C API and in a few cases, a reference to a `char**` was required as input on the C side (to realize multiple string outputs). [In the `ccall`](https://github.com/JuliaPerf/LIKWID.jl/blob/054f00a35439f7a528c25efdcbd8da657ff8138d/src/LibLikwid.jl#L889) I have `Ptr{Ptr{Ptr{Cchar}}}` for the input argument and to call it, I create and pass over a `Ref{Ptr{Ptr{Cchar}}}()`. Later, I use `unsafe_wrap` to get the strings.

---

_[View the full topic](https://discourse.julialang.org/t/what-is-the-correct-way-to-create-a-pointer-to-pointer/71442)._
