mirror of
https://github.com/dart-lang/sdk
synced 2024-09-15 23:59:47 +00:00
22 lines
657 B
Dart
22 lines
657 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.
|
||
|
|
||
|
import 'dart:ffi' as ffi;
|
||
|
|
||
|
typedef NativeDoubleUnOp = ffi.Double Function(ffi.Double);
|
||
|
|
||
|
typedef DoubleUnOp = double Function(double);
|
||
|
|
||
|
main(List<String> arguments) {
|
||
|
ffi.DynamicLibrary l = ffi.DynamicLibrary.open("ffi_test_dynamic_library");
|
||
|
print(l);
|
||
|
print(l.runtimeType);
|
||
|
|
||
|
var timesFour = l.lookupFunction<NativeDoubleUnOp, DoubleUnOp>("timesFour");
|
||
|
print(timesFour);
|
||
|
print(timesFour.runtimeType);
|
||
|
|
||
|
print(timesFour(3.0));
|
||
|
}
|