Is it possible to call Dart method from C++?

前提是你 提交于 2021-01-04 07:56:06

问题


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


回答1:


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.



来源:https://stackoverflow.com/questions/18046853/is-it-possible-to-call-dart-method-from-c

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!