是否可以从C ++调用Dart方法? [英] Is it possible to call Dart method from C++?

查看:193
本文介绍了是否可以从C ++调用Dart方法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何从C ++代码调用Dart方法?我想尝试在应用程序中使用Dart作为脚本语言.

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

推荐答案

您有两种可能:

首先,您可以将Dart VM嵌入C ++程序.请参见此讨论(有一个GitHub例子).这使您可以用C ++编写程序并运行Dart脚本.我认为Dart团队不直接支持这种方式,您需要自己做很多事情.

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.

第二,您可以将C ++代码作为本机扩展嵌入到Dart VM中.有关详细信息,请参见本指南.这使您可以用Dart编写程序,并且可以将对性能至关重要的部分或需要访问本机库的部分移动到C ++.有很多可用的示例.

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.

这篇关于是否可以从C ++调用Dart方法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆