cffi-lua icon indicating copy to clipboard operation
cffi-lua copied to clipboard

Access Violation exception when filling an array element

Open gynt opened this issue 4 months ago • 0 comments

cffi.cdef([[
  struct A {
    int a;
    int b;
  };
]])

array = cffi.new("struct A[10]", {})
element = array[4]
cffi.fill(element, cffi.sizeof("struct A"), 0) -- access violation

To avoid this, I have to use cffi.addressof:

cffi.fill(cffi.addressof(element), cffi.sizeof("struct A"), 0) -- no access violation

Windows 11, lua x86 5.4.6

gynt avatar Sep 10 '25 20:09 gynt