mirror of
https://github.com/dart-lang/sdk
synced 2024-10-04 19:08:14 +00:00
[vm/ffi] Add Dart_IsNull
in dart_api_dl.h
TEST=tests/ffi/vmspecific_handle_dynamically_linked_test.dart Closes: https://github.com/dart-lang/sdk/pull/50466 Closes: https://github.com/dart-lang/sdk/issues/48331 GitOrigin-RevId: ce49a64788310a755cd9bb5c7ff6d281830bcc33 Change-Id: Ia8e23c57c76767d9e3db799b8fe6b172071582a2 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/269742 Reviewed-by: Tess Strickland <sstrickl@google.com> Commit-Queue: Daco Harkes <dacoharkes@google.com> Reviewed-by: Daco Harkes <dacoharkes@google.com>
This commit is contained in:
parent
5d677b4e22
commit
50e18b8160
|
@ -97,7 +97,9 @@ typedef void (*Dart_NativeMessageHandler_DL)(Dart_Port_DL dest_port_id,
|
|||
(Dart_Handle port, Dart_Port_DL * port_id)) \
|
||||
/* Scopes */ \
|
||||
F(Dart_EnterScope, void, (void)) \
|
||||
F(Dart_ExitScope, void, (void))
|
||||
F(Dart_ExitScope, void, (void)) \
|
||||
/* Objects */ \
|
||||
F(Dart_IsNull, bool, (Dart_Handle))
|
||||
|
||||
#define DART_API_ALL_DL_SYMBOLS(F) \
|
||||
DART_NATIVE_API_DL_SYMBOLS(F) \
|
||||
|
|
|
@ -11,6 +11,6 @@
|
|||
// On backwards compatible changes the minor version is increased.
|
||||
// The versioning covers the symbols exposed in dart_api_dl.h
|
||||
#define DART_API_DL_MAJOR_VERSION 2
|
||||
#define DART_API_DL_MINOR_VERSION 0
|
||||
#define DART_API_DL_MINOR_VERSION 1
|
||||
|
||||
#endif /* RUNTIME_INCLUDE_DART_VERSION_H_ */ /* NOLINT */
|
||||
|
|
|
@ -27,7 +27,7 @@ main() async {
|
|||
print("C = C T1 or C T2.");
|
||||
print("Dart: Setup.");
|
||||
Expect.isTrue(NativeApi.majorVersion == 2);
|
||||
Expect.isTrue(NativeApi.minorVersion >= 0);
|
||||
Expect.isTrue(NativeApi.minorVersion >= 1);
|
||||
final initializeApi = dl.lookupFunction<IntPtr Function(Pointer<Void>),
|
||||
int Function(Pointer<Void>)>("InitDartApiDL");
|
||||
Expect.isTrue(initializeApi(NativeApi.initializeApiDLData) == 0);
|
||||
|
|
|
@ -36,7 +36,7 @@ main() async {
|
|||
print("C = C T1 or C T2.");
|
||||
print("Dart: Setup.");
|
||||
Expect.isTrue(NativeApi.majorVersion == 2);
|
||||
Expect.isTrue(NativeApi.minorVersion >= 0);
|
||||
Expect.isTrue(NativeApi.minorVersion >= 1);
|
||||
final initializeApi = dl.lookupFunction<IntPtr Function(Pointer<Void>),
|
||||
int Function(Pointer<Void>)>("InitDartApiDL");
|
||||
Expect.isTrue(initializeApi(NativeApi.initializeApiDLData) == 0);
|
||||
|
|
|
@ -54,7 +54,7 @@ final closureCallbackPointer =
|
|||
|
||||
void doDynamicLinking() {
|
||||
Expect.isTrue(NativeApi.majorVersion == 2);
|
||||
Expect.isTrue(NativeApi.minorVersion >= 0);
|
||||
Expect.isTrue(NativeApi.minorVersion >= 1);
|
||||
final initializeApi = testLibrary.lookupFunction<
|
||||
IntPtr Function(Pointer<Void>),
|
||||
int Function(Pointer<Void>)>("InitDartApiDL");
|
||||
|
|
|
@ -13,11 +13,12 @@ import 'dylib_utils.dart';
|
|||
void main() {
|
||||
doDynamicLinking();
|
||||
testHandle();
|
||||
testNativeAPIs();
|
||||
}
|
||||
|
||||
void doDynamicLinking() {
|
||||
Expect.isTrue(NativeApi.majorVersion == 2);
|
||||
Expect.isTrue(NativeApi.minorVersion >= 0);
|
||||
Expect.isTrue(NativeApi.minorVersion >= 1);
|
||||
final initializeApi = testLibrary.lookupFunction<
|
||||
IntPtr Function(Pointer<Void>),
|
||||
int Function(Pointer<Void>)>("InitDartApiDL");
|
||||
|
@ -32,6 +33,13 @@ void testHandle() {
|
|||
Expect.isTrue(identical(s, result));
|
||||
}
|
||||
|
||||
void testNativeAPIs() {
|
||||
// No need to expect here, `lookupFunction` throws an argument error if lookup fails.
|
||||
testLibrary.lookupFunction<
|
||||
Bool Function(Handle),
|
||||
bool Function(Object)>("Dart_IsNull_DL");
|
||||
}
|
||||
|
||||
class SomeClass {
|
||||
// We use this getter in the native api, don't tree shake it.
|
||||
@pragma("vm:entry-point")
|
||||
|
|
|
@ -15,11 +15,12 @@ import 'dylib_utils.dart';
|
|||
void main() {
|
||||
doDynamicLinking();
|
||||
testHandle();
|
||||
testNativeAPIs();
|
||||
}
|
||||
|
||||
void doDynamicLinking() {
|
||||
Expect.isTrue(NativeApi.majorVersion == 2);
|
||||
Expect.isTrue(NativeApi.minorVersion >= 0);
|
||||
Expect.isTrue(NativeApi.minorVersion >= 1);
|
||||
final initializeApi = testLibrary.lookupFunction<
|
||||
IntPtr Function(Pointer<Void>),
|
||||
int Function(Pointer<Void>)>("InitDartApiDL");
|
||||
|
@ -34,6 +35,13 @@ void testHandle() {
|
|||
Expect.isTrue(identical(s, result));
|
||||
}
|
||||
|
||||
void testNativeAPIs() {
|
||||
// No need to expect here, `lookupFunction` throws an argument error if lookup fails.
|
||||
testLibrary.lookupFunction<
|
||||
Bool Function(Handle),
|
||||
bool Function(Object)>("Dart_IsNull_DL");
|
||||
}
|
||||
|
||||
class SomeClass {
|
||||
// We use this getter in the native api, don't tree shake it.
|
||||
@pragma("vm:entry-point")
|
||||
|
|
Loading…
Reference in a new issue