-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
27 changed files
with
483 additions
and
159 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 34 additions & 14 deletions
48
pkgs/ffigen/example/ffinative/lib/generated_bindings.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,51 +1,71 @@ | ||
// Copyright (c) 2020, 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. | ||
|
||
// ignore_for_file: deprecated_member_use | ||
|
||
// AUTO GENERATED FILE, DO NOT EDIT. | ||
// | ||
// Generated by `package:ffigen`. | ||
// ignore_for_file: type=lint | ||
@ffi.DefaultAsset('package:ffinative_example/generated_bindings.dart') | ||
library; | ||
|
||
import 'dart:ffi' as ffi; | ||
import '' as self; | ||
|
||
/// Adds 2 integers. | ||
@ffi.Native<ffi.Int Function(ffi.Int, ffi.Int)>( | ||
symbol: 'sum', assetId: 'package:ffinative_example/generated_bindings.dart') | ||
@ffi.Native<ffi.Int Function(ffi.Int, ffi.Int)>() | ||
external int sum( | ||
int a, | ||
int b, | ||
); | ||
|
||
/// Subtracts 2 integers. | ||
@ffi.Native<ffi.Int Function(ffi.Int, ffi.Int)>( | ||
symbol: 'subtract', | ||
assetId: 'package:ffinative_example/generated_bindings.dart') | ||
@ffi.Native<ffi.Int Function(ffi.Int, ffi.Int)>() | ||
external int subtract( | ||
int a, | ||
int b, | ||
); | ||
|
||
/// Multiplies 2 integers, returns pointer to an integer,. | ||
@ffi.Native<ffi.Pointer<ffi.Int> Function(ffi.Int, ffi.Int)>( | ||
symbol: 'multiply', | ||
assetId: 'package:ffinative_example/generated_bindings.dart') | ||
@ffi.Native<ffi.Pointer<ffi.Int> Function(ffi.Int, ffi.Int)>() | ||
external ffi.Pointer<ffi.Int> multiply( | ||
int a, | ||
int b, | ||
); | ||
|
||
/// Divides 2 integers, returns pointer to a float. | ||
@ffi.Native<ffi.Pointer<ffi.Float> Function(ffi.Int, ffi.Int)>( | ||
symbol: 'divide', | ||
assetId: 'package:ffinative_example/generated_bindings.dart') | ||
@ffi.Native<ffi.Pointer<ffi.Float> Function(ffi.Int, ffi.Int)>() | ||
external ffi.Pointer<ffi.Float> divide( | ||
int a, | ||
int b, | ||
); | ||
|
||
/// Divides 2 floats, returns a pointer to double. | ||
@ffi.Native<ffi.Pointer<ffi.Double> Function(ffi.Float, ffi.Float)>( | ||
symbol: 'dividePrecision', | ||
assetId: 'package:ffinative_example/generated_bindings.dart') | ||
@ffi.Native<ffi.Pointer<ffi.Double> Function(ffi.Float, ffi.Float)>() | ||
external ffi.Pointer<ffi.Double> dividePrecision( | ||
double a, | ||
double b, | ||
); | ||
|
||
@ffi.Native<ffi.Int>() | ||
external int log_level; | ||
|
||
@ffi.Array.multi([5]) | ||
@ffi.Native<ffi.Array<ffi.Int>>() | ||
external ffi.Array<ffi.Int> array; | ||
|
||
/// Version of the native C library | ||
@ffi.Native<ffi.Pointer<ffi.Char>>() | ||
external final ffi.Pointer<ffi.Char> library_version; | ||
|
||
const addresses = _SymbolAddresses(); | ||
|
||
class _SymbolAddresses { | ||
const _SymbolAddresses(); | ||
ffi.Pointer<ffi.NativeFunction<ffi.Int Function(ffi.Int, ffi.Int)>> get sum => | ||
ffi.Native.addressOf(self.sum); | ||
ffi.Pointer<ffi.Pointer<ffi.Char>> get library_version => | ||
ffi.Native.addressOf(self.library_version); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.