1

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.

ngrid
  • 21
  • 3
  • Which language, C **or** C++? They are distinct languages. For example C++ allows function overloading and compilers may use name mangling to resolve the function symbols. There is no name mangling in C. Please adjust your language tags appropriately. Also, there is no single language "C/C++". – Thomas Matthews Sep 10 '21 at 16:41
  • @ThomasMatthews Edited. C++ is the relevant one, although planning to use `extern "C"` to make the external API callable from C – ngrid Sep 10 '21 at 17:58
  • 1
    @ngrid The link in the 2013 answer goes to [a page on the Dart site](https://dart.dev/server/c-interop-native-extensions) that is quite a lot newer than the Q&A pointing to it. Front and center on that page is the Dart Embedding API and link to its examples. – Ben Voigt Sep 10 '21 at 20:26
  • Ah totally missed that, thank you @BenVoigt! – ngrid Sep 10 '21 at 20:44

0 Answers0