mirror of
https://github.com/dart-lang/sdk
synced 2024-10-14 17:59:39 +00:00
[ffi/doc] Document the type requirements of native functions
Closes: https://github.com/dart-lang/sdk/issues/53623 CoreLibraryReviewExempt: VM and WASM API only, only updates doc. Change-Id: Id7378da13aaac3546c9c227ed568ff346e33dddf Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/328260 Reviewed-by: Lasse Nielsen <lrn@google.com> Auto-Submit: Daco Harkes <dacoharkes@google.com> Commit-Queue: Daco Harkes <dacoharkes@google.com>
This commit is contained in:
parent
9e3635c790
commit
a71a1bfcfb
|
@ -1134,7 +1134,7 @@ abstract final class NativeApi {
|
|||
/// NOTE: This experimental feature is replaced by [Native].
|
||||
@Since('2.14')
|
||||
@Deprecated('Use Native instead.')
|
||||
final class FfiNative<T> {
|
||||
final class FfiNative<T extends Function> {
|
||||
final String nativeName;
|
||||
|
||||
/// Whether the function is a leaf function.
|
||||
|
@ -1173,8 +1173,9 @@ final class FfiNative<T> {
|
|||
/// are resolved against an asset, and to, optionally, provide overrides
|
||||
/// of the default symbol and asset IDs.
|
||||
///
|
||||
/// The type argument to the [Native] annotation must be a function type
|
||||
/// The type argument [T] to the [Native] annotation must be a function type
|
||||
/// representing the native function's parameter and return types.
|
||||
/// The parameter and return types must be subtypes of [NativeType].
|
||||
///
|
||||
/// Example:
|
||||
///
|
||||
|
|
|
@ -140,6 +140,8 @@ abstract final class Handle extends NativeType {}
|
|||
|
||||
/// Represents a function type in C.
|
||||
///
|
||||
/// The return type and argument types in [T] must be a subtype of [NativeType].
|
||||
///
|
||||
/// [NativeFunction] is not constructible in the Dart code and serves purely as
|
||||
/// marker in type signatures.
|
||||
@unsized
|
||||
|
|
Loading…
Reference in a new issue