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

Allow spawning an isolate for a library #12611

Open
munificent opened this issue Aug 21, 2013 · 4 comments
Open

Allow spawning an isolate for a library #12611

munificent opened this issue Aug 21, 2013 · 4 comments
Assignees
Labels

Comments

@munificent
Copy link
Member

Currently, if you spawn an isolate in the standalone VM given a URL to a Dart library with no main(), you get:

in ShutdownIsolate: Unable to resolve function 'main' in library 'file:///.../plugin.dart'.

And the app terminates.

For plug-ins, the typical pattern is to load code dynamically and then use reflection/mirrors to determine what to invoke instead of relying on a fixed entrypoint. To get around this in the dev server, we currently procedurally create a temporary Dart script that has a no-op main() method and imports the real library. Then we save that to a temp directory and use that URL to spawn the isolate. That's obviously pretty gross.

Instead, I'm thinking something like:

    SendPort spawnIsolate(String url, {bool invokeMain: true});

If invokeMain is false, it just loads the isolate without calling main() (whether or not it's there).

Note that I only need this to work in the standalone VM, so my need isn't gated on dart2js or Dartium support for it.

@nex3
Copy link
Member

nex3 commented Aug 21, 2013

This also presupposes a way to invoke functions/create classes in the isolate. [mirrorSystemOf] may accomplish this.

@munificent
Copy link
Member Author

Right, I'm assuming mirrorSystemOf() will cover this and work as advertised. If it doesn't, we'll file more bugs. :)

@nex3
Copy link
Member

nex3 commented Aug 21, 2013

Marked this as being blocked by #12614.

@anders-sandholm
Copy link
Contributor

Added Area-Library label.

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

No branches or pull requests

6 participants