Skip to content

enum exclusions not working with ffigen #2714

@jardon

Description

@jardon

hello!

im new to ffigen, but i think that ive hit a bug. i have been attempting to create bindings for a C library using ffigen and need to exclude enums as those need to be implemented in dart. according to the docs, the enums.exclude key should be used to pass exclusions to ffigen. this happens on 19.1.0 and on main. based on the docs and the ffigen schema the following snippet should work afaik:

name: FlatpakBindings
output: 'lib/src/flatpak_bindings.dart'
headers:
  entry-points:
    - '/usr/include/flatpak/flatpak.h'
compiler-opts:
  - '-I/usr/include/glib-2.0'
  - '-I/usr/lib/x86_64-linux-gnu/glib-2.0/include' # Or similar path for glibconfig.h
  - '-I/usr/include/gio-unix-2.0'
  - '-I/usr/include/flatpak'
enums:
  exclude:
    - 'FlatpakInstallFlags'

despite the config, i still get the following error:

[SEVERE] : The integer type used for enums is implementation-defined. FFIgen tries to mimic the integer sizes chosen by the most common compilers for the various OS and architecture combinations. To prevent any crashes, remove the enums from your API surface. To rely on the (unsafe!) mimicking, you can silence this warning by adding silence-enum-warning: true to the FFIgen config. Affected enums:
	FlatpakInstallFlags

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions