Is it possible to call Dart method from C++?
Asked Answered
P

1

3

How to call Dart method from C++ code? I want to try use Dart as scripting language in my application.

Psychognosis answered 4/8, 2013 at 19:39 Comment(0)
S
6

You have two possibilities:

First, you can embed the Dart VM into your C++ program. See this discussion (there is a GitHub example). This allows you to write you program in C++ and run Dart scripts. I don't think that this way is supported by the Dart team directly, you need to do many things yourself.

Second, you can embed your C++ code into the Dart VM as a native extension. See this guide for details. This allows you to write your program in Dart and you can move performance critical parts or parts that need access to native libraries, to C++. There are many examples available.

Synge answered 4/8, 2013 at 20:37 Comment(1)
Note that the tables have turned, the linked "this guide" page indicates that embedding the VM is now well-supported and the native-extension technique is retired.Flurry

© 2022 - 2024 — McMap. All rights reserved.