To have buf3 as a non-owning reference to the same memory:
buf3=ffi.cast("float(&)[10][3]",buf2)
To have buf3 be an owning copy, then do ffi.new followed by a memcpy
equivalent.
On Wed, Jan 22, 2020 at 10:01 AM Victor Bombi <sonoro@xxxxxxxxxxxxxx> wrote:
Or why last cast should not be done this way?
On January 20, 2020 at 9:47 AM Victor Bombi <sonoro@xxxxxxxxxxxxxx>
wrote:
Hello,
local buf = ffi.new"float[10][3]"
local buf2 = ffi.cast("float*",buf)
local buf3 = ffi.cast("float[10][3]",buf2)
The third cast says: bad argument #1 to 'cast' (invalid C type)
How can the last cast be done?
Thanks
victor bombi