Skip to content

[vm/ffi] int, long, size_t, uintptr_t, wchar_t, etc #36140

@dcharkes

Description

@dcharkes

Update 2022-01-20: This will be available in dart:ffi from Dart 2.17 (and from now on tip of tree). In the mean time this is also available in package:ffi for Dart 2.16 (dev release).

Update 2021-01-07: We will implement this by implementing #42563 and probably adding the common types to package:ffi.

Currently dart:ffi only supports:

  • int8_t
  • int16_t
  • int32_t
  • int64_t
  • uint8_t
  • uint16_t
  • uint32_t
  • uint64_t
  • intptr_t
  • float
  • double

However, many C APIs use C types such as int, long, size_t, uintptr_t, and wchar_t.

We could support these types. The question is if we support these types, then what other types should we support.

An alternative could be to not support these types but provide a way for users to specify types which differ in size per platform.

@jonasfj @sjindel-google

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-core-librarySDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries.library-ffitype-design

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions