# C function with pointer of pointer

**URL:** <https://forum.crystal-lang.org/t/c-function-with-pointer-of-pointer/505>\
**Category:** Help & Support\
**Created:** [March 4, 2019, 1:14pm UTC](https://forum.crystal-lang.org/t/c-function-with-pointer-of-pointer/505 "2019-03-04T13:14:20Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Guillaume](https://avatars.discourse-cdn.com/v4/letter/g/c67d28/32.png) [@Guillaume](https://forum.crystal-lang.org/u/Guillaume)\
**Post date:** [March 4, 2019, 1:14pm UTC](https://forum.crystal-lang.org/t/c-function-with-pointer-of-pointer/505/1 "2019-03-04T13:14:20Z")

</div>

Hello,

How do I call a C function from Crystal which is returning a string in argument?

The C function is bool myfunction(char \*\* result);  
I tried the following:  
fun myFunction (ts : UInt8\*\*) : Bool and to use it like this: MyLib.myFunction( pointerof(ts) )  
It gives me the following error:  
must be Pointer(Pointer(UInt8)), not Pointer(String)

I tried to call it as MyLib.myFunction( out ts) which gives an undefined reference to ‘myFunction’  
I tried also to give a pointerof a pointer of a UInt8 which gives this error: can’t take address of pointerof(ts)

---

<div class="post-metadata">

**Author:** ![bcardiff](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.crystal-lang.org/bcardiff/32/3_2.png) [@bcardiff](https://forum.crystal-lang.org/u/bcardiff)\
**Post date:** [March 6, 2019, 8:25pm UTC](https://forum.crystal-lang.org/t/c-function-with-pointer-of-pointer/505/2 "2019-03-06T20:25:19Z")

</div>

This got into spam filter. Given [Using pointer of pointers in C](https://forum.crystal-lang.org/t/using-pointer-of-pointers-in-c/508) I guess this is already addressed, right?

---

<div class="post-metadata">

**Author:** ![Guillaume](https://avatars.discourse-cdn.com/v4/letter/g/c67d28/32.png) [@Guillaume](https://forum.crystal-lang.org/u/Guillaume)\
**Post date:** [March 7, 2019, 1:09pm UTC](https://forum.crystal-lang.org/t/c-function-with-pointer-of-pointer/505/3 "2019-03-07T13:09:46Z")

</div>

Yes, I thought this post did not work so I submit another one.
