ngrid
ngrid

Reputation: 31

How can I call Dart from C++?

I've found several posts about this and it sounds like the answer is that it's possible by embedding the Dart VM (based on this 2013 post and this 2019 post).

  1. Is this still the best way?
  2. If so, is there official guidance from Dart on how to do this, or are you on your own? I know there's this demo of embedding Dart in Windows but it's from 9 years ago and I'm wondering if there's anything more recent to reference.

Note that this is different from Dart code calling C using dart:ffi which then has a callback into Dart, which I see is supported. I'm looking for a way for a C++ program to call Dart code.

Upvotes: 2

Views: 690

Answers (1)

PurplePolyhedron
PurplePolyhedron

Reputation: 895

Currently, As suggested on the dart website, You could use the Dart Embedding API to build the Dart VM into a dynamic library with project such as dart_shared_library

Upvotes: 0

Related Questions