How to send uint8_t array from C to GO

Hello @skillian ,

Thanks for your reply, i use the seconde solution like you describe and it’s work fine.

I have just another question on the same subject ! do you know how can i put variable into the bound of array ?

Relpace this line : 
p16byte := *((*[16]byte)(unsafe.Pointer(p)))

By : 
 int lens_var = 16
 p16byte := *((*[lens_var]byte)(unsafe.Pointer(p)))

But it’s not working, because it’s not already compiled, i try also to use slice but also that doesn’t work:

int lens_var = 16
var type_var= make([]byte, lens_var )
p16byte := *((*type_var)(unsafe.Pointer(p)))

Maybe i ignore some details !!!

Thanks again

2 Likes