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

Unavailable inline C function #383

Closed
Sunbreak opened this issue Feb 9, 2021 · 5 comments
Closed

Unavailable inline C function #383

Sunbreak opened this issue Feb 9, 2021 · 5 comments

Comments

@Sunbreak
Copy link
Contributor

Sunbreak commented Feb 9, 2021

Ref: woodemi/libusb.dart#10

Inline C function

static inline uint16_t libusb_cpu_to_le16(const uint16_t x)

generates Dart function

int libusb_cpu_to_le16(
  int x,
)

which is unavailable within dynamic library


Could we skip inline functions or generate some inline implementations?

@dcharkes
Copy link
Collaborator

dcharkes commented Feb 9, 2021

We should skip them. (Generating an implementation for an arbitrary function would be very involved.)

@Sunbreak
Copy link
Contributor Author

Sunbreak commented Feb 19, 2021

@Sunbreak
Copy link
Contributor Author

BTW, why --enable-experiment: non-nullable is needed in analysis_options.yaml, ordart migrate fails with This requires the 'non-nullable' language feature to be enabled.

On the other hand, running example via dart doesn't require --enable-experiment=non-nullable

analyzer: 1.0.0 has nullsafety support already

Ref: https://stackoverflow.com/questions/57598838/non-nullable-by-default-how-to-enable-the-experiment

@mannprerak2
Copy link
Contributor

why --enable-experiment: non-nullable is needed in analysis_options.yaml, or dart migrate fails with This requires the 'non-nullable' language feature to be enabled.

I am not sure what's exactly happening, can you give some more details?

My guess is that you might be running examples from the master branch. Please try out the dart-dev branch (it depends sdk version 2.12.0-259.beta. The examples in master branch currently run in unsound null safety. so you don't need the flag when running those.

The analyzer shouldn't complain about enabling the flag, since it has been enabled by default on 2.12.0-259.beta. Maybe your IDE is using an older version of dart SDK?

@Sunbreak
Copy link
Contributor Author

Thanks for response. I'd like to file another issue in https://github.com/dart-lang/sdk

@liamappelbe liamappelbe transferred this issue from dart-archive/ffigen Nov 15, 2023
parlough pushed a commit to parlough/native that referenced this issue Apr 8, 2024
* Add an isInstance method for checking the type of an object.

* Tighten up the test

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

No branches or pull requests

4 participants