Skip to content

dart2aot: support creating dynamically linked library #37480

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

Closed
truongsinh opened this issue Jul 10, 2019 · 2 comments
Closed

dart2aot: support creating dynamically linked library #37480

truongsinh opened this issue Jul 10, 2019 · 2 comments
Labels
area-vm Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends. type-enhancement A request for a change that isn't a bug vm-native

Comments

@truongsinh
Copy link

Similar to #36915, but compile to a dynamically linked library (dll) / shared object (so) instead, so that it can be dlopened from other languages' FFI (or even Dart's own FFI #34452).

@truongsinh
Copy link
Author

cc @joshirio

@a-siva a-siva added type-enhancement A request for a change that isn't a bug area-vm Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends. vm-native labels Jul 10, 2019
@ghost ghost deleted a comment from shinayser Sep 27, 2019
@mkustermann
Copy link
Member

mkustermann commented Dec 29, 2020

Compared to other languages (such as C or Rust) the Dart language cannot be simply compiled to machine code using dart2aot and be self-contained. Instead it needs to run inside an embedder which will contain various parts of the Dart VM (garbage collector, runtime type system, ...).

This means it's simply not possible to just dlopen() a AOT-compiled Dart application, look up symbols via dlsym() and call functions in them.

In order to achieve this one would need to create a standalone embedder containing the Dart VM. One could then dlopen() this embedder and ask it to load an AOT compiled application as well as ask it to execute functions in them. (This is in fact exactly what Flutter does: it has a libflutter.so embedder containing the Dart VM).

See also #42667

Since we have no plans to work on a standalone embedder loadable as a shared library and such an embedder could be created by the community, I hope it's all right to close this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-vm Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends. type-enhancement A request for a change that isn't a bug vm-native
Projects
None yet
Development

No branches or pull requests

3 participants