Hi @mashingan, @Stefan_Salewski I find it impossible to allocate memory for array, as when I try to do something like: var p_arr = alloc(size_of(array[int, 3]))
I get a 'type expected' error. Besides, if array is created on the stack then passing a pointer to it is meaningless anyway. So I have tried with a sequence instead, proc test_arr(): ptr seq[int] {.cdecl, exportc} = var list = newSeq[int](3) list[0] = 4 list[1] = 5 list[2] = 6 GC_ref(list) # mark it as referenced return addr list In theory, this should work: the sequence goes on the heap, I'm preventing it from being swept by the GC and I'm returning a pointer to the client. But it doesn't, I'm still getting rubbish numbers on the client side I have tried a number of variations on this theme but no luck Any suggestions / ideas will be very welcome