Skip to content

Need to return struct from the function. #8

Description

@darkstarx

Hello! Could you help me with structs?

I have a function like that

struct Offset2D
{
    double x;
    double y;
};

struct Offset2D createOffset2D(double x, double y);

How can I use this function with web_ffi? How should I change this code in Dart to work with Offset2D on the Dart side?

class Offset2D extends ffi.Struct {
  @ffi.Double()
  external double x;

  @ffi.Double()
  external double y;
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions