theman
theman

Reputation: 345

ffi.C missing all declarations for all symbols

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

Answers (1)

theman
theman

Reputation: 345

Oops, didn't put free into my cdef! Fixed.

ffi.cdef[[
  void free(void *ptr);
]]

Upvotes: 6

Related Questions