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

[native_assets_cli] The CLI should add binding and call Dart_InitializeApiDL automatically if not provided by the user. #1808

Open
ykmnkmi opened this issue Dec 12, 2024 · 7 comments

Comments

@ykmnkmi
Copy link

ykmnkmi commented Dec 12, 2024

Spent some hours because I thought it was called automatically. And I haven't looked at the use_dart_api/test/use_dart_api_test.dart file before.

@dcharkes
Copy link
Collaborator

Hi @ykmnkmi, nice to meet you!

I'm not sure how to achieve that. Dart_InitializeApiDL from runtime/include/dart_api_dl.c is compiled into your own dynamic library instead of the Dart VM. So it must be called for every dynamic library, and you might load that dynamic library even from C code instead of directly via dart:ffi.

Maybe we can instead improve the documentation in the right place. Because it's not obvious what goes wrong if you forget to initialize.

The CLI

Do you mean with hook/build.dart files? Or in general when executing Dart code?

@ykmnkmi
Copy link
Author

ykmnkmi commented Dec 12, 2024

After digging deeper, I see it should be called by the user. Better documentation would help.

@ykmnkmi
Copy link
Author

ykmnkmi commented Dec 12, 2024

I use my own builder that wraps Zig build system.

@dcharkes
Copy link
Collaborator

After digging deeper, I see it should be called by the user. Better documentation would help.

Any suggestions on where to put it?

I use my own builder that wraps Zig build system.

Cool!

@ykmnkmi
Copy link
Author

ykmnkmi commented Dec 12, 2024

Note in use_dart_api README.md?

@dcharkes
Copy link
Collaborator

Note in use_dart_api README.md?

Would you please submit a PR?

@ykmnkmi
Copy link
Author

ykmnkmi commented Dec 13, 2024

I do.

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

2 participants