mirror of
https://github.com/dart-lang/sdk
synced 2024-09-16 00:39:49 +00:00
8ee8f882ea
Everything in FFI is nonnullable, because C does not accept null values or return null values (nullptr == 0, not null). The only thing that needed migration in the FFI api is operator == (dynamic other) --> operator == (Object other). This CL does not migrate any tests as the VM cannot run any tests yet. Fixes: https://github.com/dart-lang/sdk/issues/39144 Change-Id: I5efc772b61228bd1bd4d95be1b7bcd969f0c9ac8 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/131380 Commit-Queue: Daco Harkes <dacoharkes@google.com> Reviewed-by: Leaf Petersen <leafp@google.com>
38 lines
1.5 KiB
Dart
38 lines
1.5 KiB
Dart
// Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file
|
|
// for details. All rights reserved. Use of this source code is governed by a
|
|
// BSD-style license that can be found in the LICENSE file.
|
|
|
|
part of dart.ffi;
|
|
|
|
class DartRepresentationOf {
|
|
/// Represents the Dart type corresponding to a [NativeType].
|
|
///
|
|
/// [Int8] -> [int]
|
|
/// [Int16] -> [int]
|
|
/// [Int32] -> [int]
|
|
/// [Int64] -> [int]
|
|
/// [Uint8] -> [int]
|
|
/// [Uint16] -> [int]
|
|
/// [Uint32] -> [int]
|
|
/// [Uint64] -> [int]
|
|
/// [IntPtr] -> [int]
|
|
/// [Double] -> [double]
|
|
/// [Float] -> [double]
|
|
/// [Pointer]<T> -> [Pointer]<T>
|
|
/// [NativeFunction]<T1 Function(T2, T3) -> S1 Function(S2, S3)
|
|
/// where DartRepresentationOf(Tn) -> Sn
|
|
/// T extends Struct -> T
|
|
const DartRepresentationOf(String nativeType);
|
|
}
|
|
|
|
class Unsized {
|
|
const Unsized();
|
|
}
|
|
|
|
/// This [NativeType] does not have predefined size.
|
|
///
|
|
/// Unsized NativeTypes do not support [sizeOf] because their size is unknown.
|
|
/// Consequently, [allocate], [Pointer.load], [Pointer.store], and
|
|
/// [Pointer.elementAt] are not available.
|
|
const unsized = const Unsized();
|