Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pkg_ffi.Size doesn't map to int #20

Closed
Sunbreak opened this issue Feb 8, 2022 · 0 comments · Fixed by #21
Closed

pkg_ffi.Size doesn't map to int #20

Sunbreak opened this issue Feb 8, 2022 · 0 comments · Fixed by #21

Comments

@Sunbreak
Copy link
Collaborator

Sunbreak commented Feb 8, 2022

Since 0763bbd upgraded to ffigen 5.0.0-dev.0

flutter pub run ffigen results in pkg_ffi.Size in Dart funtion decleration

  ffi.Pointer<pkg_ffi.UnsignedChar> libusb_dev_mem_alloc(
    ffi.Pointer<libusb_device_handle> dev_handle,
    pkg_ffi.Size length,
  ) {
    return _libusb_dev_mem_alloc(
      dev_handle,
      length,
    );
  }

  late final _libusb_dev_mem_allocPtr = _lookup<
      ffi.NativeFunction<
          ffi.Pointer<pkg_ffi.UnsignedChar> Function(
              ffi.Pointer<libusb_device_handle>,
              pkg_ffi.Size)>>('libusb_dev_mem_alloc');
  late final _libusb_dev_mem_alloc = _libusb_dev_mem_allocPtr.asFunction<
      ffi.Pointer<pkg_ffi.UnsignedChar> Function(
          ffi.Pointer<libusb_device_handle>, pkg_ffi.Size)>();
  int libusb_dev_mem_free(
    ffi.Pointer<libusb_device_handle> dev_handle,
    ffi.Pointer<pkg_ffi.UnsignedChar> buffer,
    pkg_ffi.Size length,
  ) {
    return _libusb_dev_mem_free(
      dev_handle,
      buffer,
      length,
    );
  }

  late final _libusb_dev_mem_freePtr = _lookup<
      ffi.NativeFunction<
          pkg_ffi.Int Function(
              ffi.Pointer<libusb_device_handle>,
              ffi.Pointer<pkg_ffi.UnsignedChar>,
              pkg_ffi.Size)>>('libusb_dev_mem_free');
  late final _libusb_dev_mem_free = _libusb_dev_mem_freePtr.asFunction<
      int Function(ffi.Pointer<libusb_device_handle>,
          ffi.Pointer<pkg_ffi.UnsignedChar>, pkg_ffi.Size)>();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant