Skip to content

Sharing shared definitions #539

@dcharkes

Description

@dcharkes

Consider the following scenario:

  • header1 - with a struct
  • header2 which imports header1 - having that struct in a signature
  • header3 which imports header1 - having also that struct in the signature

Now we run the generator on header 2 and 3: they both generate the same struct.
These two structs will be Dart classes with the same name but incompatible.
You can work around that with Pointer.cast<>(), but that's not safe.
Also, this increases code size.

It would be better to be able to run the generator on all 3 headers files and let the generated files for header 2 and 3 import the generated file for header 1.

We need to think about a good design for this, especially if headers 2 and 3 are in different dart packages.

(I am not sure how common this scenario is. For example libclang and sqlite3 stand very much on themselves. But I can imagine structs defined in OS APIs fall into this category, so it would be nice to address this.)

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