C function with pointer of pointer


#1

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)


#2

This got into spam filter. Given Using pointer of pointers in C I guess this is already addressed, right?


#3

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