Files
sdk/pkg/dart2bytecode/testcases/ffi.dart
T
Tess Strickland b6c060a6ab [vm,dyn_modules] Pass additional libraries to the BytecodeGenerator.
In addition to passing in the libraries that should be visited to the
bytecode generator, also pass the libraries which are needed by the
component and either are not in the component or should not be visited
(e.g., libraries from the platform when the platform is not included).

This way, the bytecode generator can create appropriate LibraryIndexes
to detect the use of `dart:` libraries which aren't already in
VmTarget.extraIndexedLibraries, and thus in coreTypes.index (e.g.,
'dart:ffi').

TEST=pkg/dart2bytecode

Cq-Include-Trybots: luci.dart.try:vm-dyn-linux-debug-x64-try,vm-dyn-mac-debug-arm64-try
Change-Id: Ic08f2022753950bf639c446c0b2594e1e269872a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/476760
Commit-Queue: Tess Strickland <sstrickl@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2026-02-06 06:13:22 -08:00

27 lines
674 B
Dart

// Copyright (c) 2026, 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.
import 'dart:ffi';
testVoidNoArg() {
final pointer = Pointer<NativeFunction<Void Function()>>.fromAddress(
0xdeadbeef,
);
final function = pointer.asFunction<void Function()>();
function();
}
testIntInt() {
final pointer = Pointer<NativeFunction<Int32 Function(Int64)>>.fromAddress(
0xdeadbeef,
);
final function = pointer.asFunction<int Function(int)>();
return function(42);
}
void main() {
testVoidNoArg();
testIntInt();
}