Skip to content

优化 Dart FFI 与 C++ 通信的方式 #128

@andycall

Description

@andycall

发现 Dart 现在支持传入一个 Dart_Handler 作为 FFI 函数的参数,这意味着任何一个 Dart 对象、函数都可以直接传递到 C,然后通过 dart_api.h 里面提供的符号进行一些调用操作,包括直接获取属性,转成函数等。

看样子是可以在中间去掉 Map 有关的映射来让 C++ 对象和 Dart 对象直接对接。

dart-lang/sdk#36858
dart-lang/sdk#35770
https://github.com/google/webcrypto.dart/blob/6dd34605b16097f2845742e04cce1aa4854b07d8/src/webcrypto_dart_dl.c#L49-L72

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions