Reputation: 345
I see in the documentation ffi.C.free is something I can use to free up malloc. I am attempting to do so here:
callbacks.free_buffer = function(buffer)
print("free_buffer_callback")
ffi.C.free(buffer)
end
I get this error:
missing declaration for symbol 'free'
does this mean I have to malloc the memory myself with the FFI first? I cannot do that in this particular function (because it is a parameter in a callback). What can I do to free this buffer?
EDIT: Looks like all ffi.C functions don't work, even outside the callback function. My ffi seems to be working fine otherwise?
Upvotes: 4
Views: 1553
Reputation: 345
Oops, didn't put free
into my cdef
! Fixed.
ffi.cdef[[
void free(void *ptr);
]]
Upvotes: 6