Jeff Ward
2016-04-19 03:13:36 UTC
I've been trying to embed the Dart VM in an executable for a few days and I
haven't been having much luck, and I'm wondering if this is still a
supported use case.
It would be nice if the following worked:
- Pull the dart source and build libdart
- Link in libdart, include dart_api.h and have that work.
Unfortunately that doesn't work. But, here's what I've tried and still
haven't had much success.
- Pull the dart source and build the full dart executable
- link in libdart, libdart_lib, libdart_vm,
libdart_vm_precompiled_runtime, and libdouble_conversion
With this approach, I'm able to build, but when the CreateIsolate callback
gets called for the "vm-service" isolate, I call "CreateIsolate" which
ASSERTS and exits (the assert is "runtime/vm/hash_table.h:378: error:
expected: !data_->IsNull()", where the most relevant function in the
callstack is Symbols::AddPredefinedSymbolsToIsolate)
It appears that even though the documentation says Dart_Iniitialize should
support supplying a NULL for both the vm_isolate_snapshot and that
Dart_CreateIsolate should support supplying a NULL isolate_snapshot, this
is no longer the case.
So, I added in the generated snapshot files to my project source
(dart_sdk_src\sdk\build\DebugX64\obj\global_intermediate\snapshot_gen.cc)
and re-ran. This gets past CreateIsolate, but fails attempting to load the
core library. ("Dart_LookupLibrary: library 'dart:builtin' not found.").
I've tried various combinations of compiling in generated files and
compiled libs but can't find a combination that links cleanly and supplies
a version of dart:builtin.
Obviously there's some amount of secret sauce here I'm missing, but I can't
figure out the magic combination to make it work.
--
Jeff
haven't been having much luck, and I'm wondering if this is still a
supported use case.
It would be nice if the following worked:
- Pull the dart source and build libdart
- Link in libdart, include dart_api.h and have that work.
Unfortunately that doesn't work. But, here's what I've tried and still
haven't had much success.
- Pull the dart source and build the full dart executable
- link in libdart, libdart_lib, libdart_vm,
libdart_vm_precompiled_runtime, and libdouble_conversion
With this approach, I'm able to build, but when the CreateIsolate callback
gets called for the "vm-service" isolate, I call "CreateIsolate" which
ASSERTS and exits (the assert is "runtime/vm/hash_table.h:378: error:
expected: !data_->IsNull()", where the most relevant function in the
callstack is Symbols::AddPredefinedSymbolsToIsolate)
It appears that even though the documentation says Dart_Iniitialize should
support supplying a NULL for both the vm_isolate_snapshot and that
Dart_CreateIsolate should support supplying a NULL isolate_snapshot, this
is no longer the case.
So, I added in the generated snapshot files to my project source
(dart_sdk_src\sdk\build\DebugX64\obj\global_intermediate\snapshot_gen.cc)
and re-ran. This gets past CreateIsolate, but fails attempting to load the
core library. ("Dart_LookupLibrary: library 'dart:builtin' not found.").
I've tried various combinations of compiling in generated files and
compiled libs but can't find a combination that links cleanly and supplies
a version of dart:builtin.
Obviously there's some amount of secret sauce here I'm missing, but I can't
figure out the magic combination to make it work.
--
Jeff
--
For other discussions, see https://groups.google.com/a/dartlang.org/
For HOWTO questions, visit http://stackoverflow.com/tags/dart
To file a bug report or feature request, go to http://www.dartbug.com/new
---
You received this message because you are subscribed to the Google Groups "Dart Misc" group.
To unsubscribe from this group and stop receiving emails from it, send an email to misc+***@dartlang.org.
For other discussions, see https://groups.google.com/a/dartlang.org/
For HOWTO questions, visit http://stackoverflow.com/tags/dart
To file a bug report or feature request, go to http://www.dartbug.com/new
---
You received this message because you are subscribed to the Google Groups "Dart Misc" group.
To unsubscribe from this group and stop receiving emails from it, send an email to misc+***@dartlang.org.