dart-sdk/tests/ffi/vmspecific_regress_37100_test.dart
Daco Harkes ac805dff54 [vm/ffi] Migrate to empty Structs to Opaque
This CL migrates empty `Struct`s to `Opaque` native types.
It stops using `.ref` on `Pointer`s to these types.
And stops using `.ref` on `Pointer<Utf8>` which will be migrated in
`package:ffi`.

Issue: https://github.com/dart-lang/sdk/issues/44622
Issue: https://github.com/dart-lang/sdk/issues/43974

Change-Id: I3aa256af7d4ceaa8ee37b1b2ada71f870f43617b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/179181
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
2021-01-15 10:52:53 +00:00

26 lines
778 B
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.
//
// SharedObjects=ffi_test_functions
import 'dart:ffi';
import "package:expect/expect.dart";
import 'dylib_utils.dart';
class EVP_MD extends Opaque {}
DynamicLibrary ffiTestFunctions = dlopenPlatformSpecific("ffi_test_functions");
final EVP_sha1 = ffiTestFunctions.lookupFunction<Pointer<EVP_MD> Function(),
Pointer<EVP_MD> Function()>('LargePointer');
main() {
int result = EVP_sha1().address;
// On 32 bit only the lowest 32 bits are returned, so only test those.
result &= 0x00000000FFFFFFFF;
Expect.equals(0x0000000082000000, result);
}