1. 7
  1.  

    1. 6

      Hope the author reads here as well:

      pub const Point = struct  {
          label: [*:0]const u8,
          x: i32,
          y: i32,
      };
      

      The problem is that they are using a plain struct, which has no defined field order. Right now, the compiler always sorts fields by descending alignment to shrink the size of the struct. There are builtins in Zig to query the offsets, if necessary.

      The correct way for FFI is using an extern struct, which follows the C ABI rules for struct layout, making the FFI work even when reordering the struct.

      1. 2

        Regarding the last issue, it’s worth trying directly via SBCL own FFI (sb-alien) rather than CFFI layer.