node-ctypes - v2.10.0
    Preparing search index...

    Function struct

    • Define a struct using the functional API.

      For Python-like class syntax, use Structure instead.

      Type Parameters

      Parameters

      • fields: F

        Object mapping field names to types

      • Optionaloptions: StructOptions

        Struct options (e.g. { packed: true })

      Returns StructDef<F>

      const PointDef = struct({ x: c_int32, y: c_int32 });
      const buf = PointDef.create({ x: 10, y: 20 });
      console.log(PointDef.get(buf, 'x')); // 10