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

Generating Unions #358

Closed
chrisnorman7 opened this issue May 12, 2021 · 11 comments · Fixed by dart-archive/ffigen#215
Closed

Generating Unions #358

chrisnorman7 opened this issue May 12, 2021 · 11 comments · Fixed by dart-archive/ffigen#215

Comments

@chrisnorman7
Copy link

Hi,
I apologise if there is already an issue for this, but either Google isn't being helpful, or I don't understand enough of the terminology to know what I'm looking at.

I'm in the process of trying to write bindings for SDL, and I'm running into issues.

SDL uses a union SDL_Event, and obviously ffigen isn't generating it.

From my research, it seems as though Union support is coming, but certainly hasn't filtered down to 2.13 as of yet. Is this true? Is there a way I can test the latest ffigen if I switch to Flutter Master?

Thanks in advance.

@mannprerak2
Copy link
Contributor

The latest version of ffigen doesn't support generating unions as of now.

I think we should probably wait till a beta (or atleast the next dev) dart sdk is released before we add support for generating unions.

cc @dcharkes

@chrisnorman7
Copy link
Author

chrisnorman7 commented May 12, 2021 via email

@dcharkes
Copy link
Collaborator

The last dev release, 2.14.0-90.0.dev, contains support for unions (with a bug though, so we might want to wait until the next dev release).

(Side note, we might want to wait with merging support for unions until after 2.13 stable comes out and we do a release for Dart 2.13 with packed structs etc. swapping to Dart stable and then after that land this swapping to Dart dev again.)

@mannprerak2
Copy link
Contributor

Hi, @chrisnorman7 I've added a draft PR for union support, not sure when we'll merge it though.

Until then you are welcome to use a git dependency to test it out. If you find any bugs, please do let us know.

@chrisnorman7
Copy link
Author

chrisnorman7 commented May 18, 2021 via email

@mannprerak2
Copy link
Contributor

@chrisnorman7 Just regenerate the bindings using ffigen from the PR branch and ffigen will generate the unions (if any in your source).
You can include/exclude/rename/rename-members exactly like structs.

@chrisnorman7
Copy link
Author

chrisnorman7 commented May 18, 2021 via email

@mannprerak2
Copy link
Contributor

Yeah, you should probably check out how unions work in C.

@chrisnorman7
Copy link
Author

chrisnorman7 commented May 18, 2021 via email

@dcharkes
Copy link
Collaborator

@chrisnorman7 you can now depend on the prerelease from pub: https://pub.dev/packages/ffigen/versions/3.1.0-dev.0

@chrisnorman7
Copy link
Author

chrisnorman7 commented May 20, 2021 via email

@liamappelbe liamappelbe transferred this issue from dart-archive/ffigen Nov 15, 2023
HosseinYousefi added a commit that referenced this issue Nov 16, 2023
* Update Dart API
* Remove unnecessary methods in dartjni.h
HosseinYousefi added a commit that referenced this issue Nov 16, 2023
* Update Dart API
* Remove unnecessary methods in dartjni.h
parlough pushed a commit to parlough/native that referenced this issue Apr 8, 2024
* ObjC interface registry

* Don't remove trailing underscores from method names

* Move isInSystemHeader to cursor utils

* Fix analysis

* Merge
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants