Thanks for the suggestion, I’ve made pretty much progress porting standalone Dart VM to iOS, here are some follow-ups:
Within the Flutter’s build environment, I built a new static library containing libdartvm with no snapshot (the precompiled runtime library is also ready, but I just need a minimalist prototype for now). This library contains all symbols to run the
embedder example, while two more kernel binary files are required:
* For the `vm_platform_strong.dill` , it’s inside the flutter engine’s compiled products for iOS. This works fine.
* For the `app.dill` kernel binary, I tweaked the flutter tool a little bit, then started an empty Flutter project, changed its lib/main.dart to a bare empty main function, got its compiled output (~5KB) from the CFE’s tmp output folder.
Now the question is that, when I call `Dart_LoadLibraryFromKernel` to load the `app.dill` file, I got an “Invalid kernel binary format version” error, which is a check that `vm_platform_strong.dill` passed. To be more specific, the Dart VM on iOS expects binary version 49, but the version of `app.dill` I compiled is 45.
The `vm_platform_strong.dill` that passed the check is compiled with Flutter engine’s source code, whose Dart VM version is
2.12.0-4.0.dev. But when I compile `app.dill`, the Dart VM running CFE on my Mac is v2.10.3. However, I got both of them coming from the official Flutter release (1.22.3), is this mismatch in VM version expected, or am I doing something wrong?
I think I’m much closer to a working prototype. I’d really appreciate any further advice. Thanks.
Yifeng