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;
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions