From 70eaa0be7187dbbedffa9cc69725a063794feca3 Mon Sep 17 00:00:00 2001 From: Liam Appelbe Date: Mon, 13 Nov 2023 08:58:30 +1300 Subject: [PATCH] Prepare for merge into dart-lang/native --- .github/workflows/test-package.yml | 8 +- CHANGELOG.md | 200 +++++++++--------- example/c_json/cjson_generated_bindings.dart | 10 +- example/c_json/pubspec.yaml | 2 +- example/ffinative/pubspec.yaml | 2 +- example/libclang-example/pubspec.yaml | 2 +- example/objective_c/avf_audio_bindings.dart | 125 ++++++----- example/objective_c/pubspec.yaml | 2 +- example/shared_bindings/pubspec.yaml | 2 +- example/simple/generated_bindings.dart | 5 +- example/simple/pubspec.yaml | 2 +- example/swift/swift_api_bindings.dart | 31 ++- pubspec.yaml | 2 +- .../_expected_boolean_dartbool_bindings.dart | 5 +- .../_expected_functions_bindings.dart | 5 +- .../_expected_cjson_bindings.dart | 10 +- .../_expected_sqlite_bindings.dart | 40 ++-- 17 files changed, 216 insertions(+), 237 deletions(-) diff --git a/.github/workflows/test-package.yml b/.github/workflows/test-package.yml index d7d9d02c..b809a9a7 100644 --- a/.github/workflows/test-package.yml +++ b/.github/workflows/test-package.yml @@ -20,7 +20,7 @@ jobs: fail-fast: false matrix: # TODO: Change to 3.2.0 stable once it's released. - sdk: [3.2.0-114.0.dev] + sdk: [3.2.0-210.4.beta] steps: - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 - uses: dart-lang/setup-dart@b64355ae6ca0b5d484f0106a033dd1388965d06d @@ -45,7 +45,7 @@ jobs: - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 - uses: dart-lang/setup-dart@b64355ae6ca0b5d484f0106a033dd1388965d06d with: - sdk: 3.2.0-114.0.dev + sdk: 3.2.0-210.4.beta - name: Install dependencies run: dart pub get - name: Install libclang-14-dev @@ -62,7 +62,7 @@ jobs: - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 - uses: dart-lang/setup-dart@b64355ae6ca0b5d484f0106a033dd1388965d06d with: - sdk: 3.2.0-114.0.dev + sdk: 3.2.0-210.4.beta - name: Install dependencies run: dart pub get - name: Build test dylib and bindings @@ -84,7 +84,7 @@ jobs: - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 - uses: dart-lang/setup-dart@b64355ae6ca0b5d484f0106a033dd1388965d06d with: - sdk: 3.2.0-114.0.dev + sdk: 3.2.0-210.4.beta - name: Install dependencies run: dart pub get - name: Build test dylib and bindings diff --git a/CHANGELOG.md b/CHANGELOG.md index a1aef8cf..bda105b4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,4 @@ -# 10.0.0-dev.0 +## 10.0.0-dev.0 - Add support for ObjC Blocks that can be invoked from any thread, using NativeCallable.listener. @@ -10,44 +10,44 @@ generate a typedef for the `Function`. - Use Dart wrapper types in args and returns of ObjCBlocks. - Use Dart wrapper types in args and returns of static functions. -- Bump min SDK version to 3.2.0-114.0.dev. +- Bump min SDK version to 3.2.0-210.4.beta. - Renamed `asset` to `assetId` for `ffi-native`. -# 9.0.1 +## 9.0.1 - Fix doc comment missing on struct/union array fields. - Allow extern inline functions to be generated. -# 9.0.0 +## 9.0.0 - Added a JSON schema for FFIgen config files. -# 8.0.2 +## 8.0.2 - Fixed invalid code generated due to zero-length arrays in structs/union. -# 8.0.1 +## 8.0.1 - Fixed invalid code generated due to anonymous structs/unions with unsupported types. -# 8.0.0 +## 8.0.0 - Stable release for Dart 3.0 with support for class modifers, variadic arguments, and `@Native`s. -# 8.0.0-dev.3 +## 8.0.0-dev.3 - Added support for variadic functions using config `functions -> variadic-arguments`. -# 8.0.0-dev.2 +## 8.0.0-dev.2 - Use `@Native` syntax instead of deprecated `@FfiNative` syntax. -# 8.0.0-dev.1 +## 8.0.0-dev.1 - Fix invalid struct/enum member references due to multiple anonymous struct/enum in a declaration. -# 8.0.0-dev.0 +## 8.0.0-dev.0 - Adds `final` class modifier to generated sub types `Struct`, `Union` and `Opaque`. A class modifier is required in Dart 3.0 because the classes @@ -58,144 +58,144 @@ `Opaque` sub types is already disallowed by `dart:ffi` pre 3.0, so adding the `final` keyword is not a breaking change. - Bumps SDK lowerbound to 3.0. -# 7.2.11 +## 7.2.11 - Fix invalid struct/enum member references due to multiple anonymous struct/enum in a declaration. -# 7.2.10 +## 7.2.10 - Generate parameter names in function pointer fields and typedefs. -# 7.2.9 +## 7.2.9 - Detect LLVM installed using Scoop on Windows machines. -# 7.2.8 +## 7.2.8 - Automatically generate `ignore_for_file: type=lint` if not specified in preamble. -# 7.2.7 +## 7.2.7 - Fix some macros not being generated in some cases due to relative header paths. -# 7.2.6 +## 7.2.6 - Fix path normalization behaviour for absolute paths and globs starting with `**`. -# 7.2.5 +## 7.2.5 - Add support nested anonymous union/struct -# 7.2.4 +## 7.2.4 - Add new supported typedef - `uintptr_t` (mapped to `ffi.UintPtr`). -# 7.2.3 +## 7.2.3 - Change compiler option order so that user options can override built-in options. -# 7.2.2 +## 7.2.2 - Added newer versions of LLVM, to default `linuxDylibLocations`. -# 7.2.1 +## 7.2.1 - Fix helper methods sometimes missing from NSString. -# 7.2.0 +## 7.2.0 - Added support for sharing bindings using `symbol-file` config. (See `README.md` and examples/shared_bindings). -# 7.1.0 +## 7.1.0 - Handle declarations with definition accessible from a different entry-point. -# 7.0.0 +## 7.0.0 - Fix typedef include/exclude config. - Return `ObjCBlock` wrapper instead of raw pointer in more cases. -# 7.0.0-dev +## 7.0.0-dev - Relative paths in ffigen config files are now assumed to be relative to the config file, rather than the working directory of the tool invocation. -# 6.1.2 +## 6.1.2 - Fix bug where function bindings were not deduped correctly. -# 6.1.1 +## 6.1.1 - _EXPERIMENTAL_ support for `FfiNative`. The API and output might change at any point. -# 6.1.0 +## 6.1.0 - Added `exclude-all-by-default` config flag, which changes the default behavior of declaration filters to exclude everything, rather than include everything. -# 6.0.2 +## 6.0.2 - Bump `package:ffi` to 2.0.1. -# 6.0.1 +## 6.0.1 - Replace path separators in `include-directives` before matching file names. - Add more ways to find `libclang`. -# 6.0.0 +## 6.0.0 - Removed config `dart-bool`. Booleans are now always generated with `bool` and `ffi.Bool` as it's Dart and C Type respectively. -# 5.0.1 +## 5.0.1 - Add a the xcode tools llvm as default path on MacOS. -# 5.0.0 +## 5.0.0 - Stable release targeting Dart 2.17, supporting ABI-specific integer types. - _EXPERIMENTAL_ support for ObjectiveC on MacOS hosts. The API and output might change at any point. Feel free to report bugs if encountered. -# 5.0.0-dev.1 +## 5.0.0-dev.1 - Fixed invalid default dart types being generated for `size_t` and `wchar_t`. -# 5.0.0-dev.0 +## 5.0.0-dev.0 - Added support for generating ABI Specific integers. - Breaking: removed config keys - `size-map` and `typedef-map`. - Added config keys - `library-imports` and `type-map`. -# 4.1.3 +## 4.1.3 - Analyzer fixes. -# 4.1.2 +## 4.1.2 - Added fix for empty include list to exclude all -# 4.1.1 +## 4.1.1 - Added fix for errors due to name collision between member name and type name used internally in structs/unions. -# 4.1.0 +## 4.1.0 - Add config key `functions -> leaf` for specifying `isLeaf:true` for functions. -# 4.0.0 +## 4.0.0 - Release for Dart SDK `>=2.14`. -# 4.0.0-dev.2 +## 4.0.0-dev.2 - Added config key `functions -> expose-typedefs` to expose the typedef to Native and Dart type. - Config key `function`->`symbol-address` no longer exposes the typedef to Native type. Use `expose-typedefs` to get the native type. -# 4.0.0-dev.1 +## 4.0.0-dev.1 - This package now targets package:lints for the generated code. The generated code uses C symbol names as is. Use either `// ignore_for_file: lintRule1, lintRule2` in the `preamble`, or rename the symbols to make package:lints happy. - Name collisions are now resolved by suffixing `` instead of `_`. -# 4.0.0-dev.0 +## 4.0.0-dev.0 - Added support for generating typedefs (_referred_ typedefs only). @@ -231,197 +231,197 @@ used somewhere. by their actual name, or if they are unnamed then by the name of the first typedef that refers to them. -# 3.1.0-dev.1 +## 3.1.0-dev.1 - Users can now specify exact path to dynamic library in `llvm-path`. -# 3.1.0-dev.0 +## 3.1.0-dev.0 - Added support for generating unions. -# 3.0.0 +## 3.0.0 - Release for dart sdk `>=2.13` (Support for packed structs and inline arrays). -# 3.0.0-beta.0 +## 3.0.0-beta.0 - Added support for inline arrays in `Struct`s. - Remove config key `array-workaround`. - Remove deprecated key `llvm-lib` from config, Use `llvm-path` instead. -# 2.5.0-beta.1 +## 2.5.0-beta.1 - Added support for `Packed` structs. Packed annotations are generated automatically but can be overriden using `structs -> pack` config. - Updated sdk constraints to `>=2.13.0-211.6.beta`. -# 2.4.2 +## 2.4.2 - Fix issues due to declarations having duplicate names. - Fix name conflict of declaration with ffi library prefix. - Fix `char` not being recognized on platforms where it's unsigned by default. -# 2.4.1 +## 2.4.1 - Added `/usr/lib` to default dynamic library location for linux. -# 2.4.0 +## 2.4.0 - Added new config key `llvm-path` that accepts a list of `path/to/llvm`. - Deprecated config key `llvm-lib`. -# 2.3.0 +## 2.3.0 - Added config key `compiler-opts-automatic -> macos -> include-c-standard-library` (default: true) to automatically find and add C standard library on macOS. - Allow passing list of string to config key `compiler-opts`. -# 2.2.5 +## 2.2.5 - Added new command line flag `--compiler-opts` to the command line tool. -# 2.2.4 +## 2.2.4 - Fix `sort: true` not working. - Fix extra `//` or `///` in comments when using `comments -> style`: `full`. -# 2.2.3 +## 2.2.3 - Added new subkey `dependency-only` (options - `full (default) | opaque`) under `structs`. When set to `opaque`, ffigen will generate empty `Opaque` structs if structs were excluded in config (i.e added because they were a dependency) and only passed by reference(pointer). -# 2.2.2 +## 2.2.2 - Fixed generation of empty opaque structs due to forward declarations in header files. -# 2.2.1 +## 2.2.1 - Fixed generation of duplicate constants suffixed with `_` when using multiple entry points. -# 2.2.0 +## 2.2.0 - Added subkey `symbol-address` to expose native symbol pointers for `functions` and `globals`. -# 2.1.0 +## 2.1.0 - Added a new named constructor `NativeLibrary.fromLookup()` to support dynamic linking. - Updated dart SDK constraints to latest stable version `2.12.0`. -# 2.0.3 +## 2.0.3 - Ignore typedef to struct pointer when possible. - Recursively create directories for output file. -# 2.0.2 +## 2.0.2 - Fixed illegal use of `const` in name, crash due to unnamed inline structs and structs having `Opaque` members. -# 2.0.1 +## 2.0.1 - Switch to preview release of `package:quiver`. -# 2.0.0 +## 2.0.0 - Upgraded all dependencies. `package:ffigen` now runs with sound null safety. -# 2.0.0-dev.6 +## 2.0.0-dev.6 - Functions marked `inline` are now skipped. -# 2.0.0-dev.5 +## 2.0.0-dev.5 - Use `Opaque` for representing empty `Struct`s. -# 2.0.0-dev.4 +## 2.0.0-dev.4 - Add support for parsing and generating globals. -# 2.0.0-dev.3 +## 2.0.0-dev.3 - Removed the usage of `--no-sound-null-safety` flag. -# 2.0.0-dev.2 +## 2.0.0-dev.2 - Removed setup phase for ffigen. Added new optional config key `llvm-lib` to specify path to `llvm/lib` folder. -# 2.0.0-dev.1 +## 2.0.0-dev.1 - Added support for passing and returning struct by value in functions. -# 2.0.0-dev.0 +## 2.0.0-dev.0 - Added support for Nested structs. -# 2.0.0-nullsafety.1 +## 2.0.0-nullsafety.1 - Removed the need for `--no-sound-null-safety` flag. -# 2.0.0-nullsafety.0 +## 2.0.0-nullsafety.0 - Migrated to (unsound) null safety. -# 1.2.0 +## 1.2.0 - Added support for `Dart_Handle` from `dart_api.h`. -# 1.1.0 +## 1.1.0 - `typedef-map` can now be used to map a typedef name to a native type directly. -# 1.0.6 +## 1.0.6 - Fixed missing typedefs nested in another typedef's return types. -# 1.0.5 +## 1.0.5 - Fixed issues with generating macros of type `double.Infinity` and `double.NaN`. -# 1.0.4 +## 1.0.4 - Updated code to use `dart format` instead of `dartfmt` for sdk version `>= 2.10.0`. -# 1.0.3 +## 1.0.3 - Fixed errors due to extended ASCII and control characters in macro strings. -# 1.0.2 +## 1.0.2 - Fix indentation for pub's readme. -# 1.0.1 +## 1.0.1 - Fixed generation of `NativeFunction` parameters instead of `Pointer` in type signatures. -# 1.0.0 +## 1.0.0 - Bump version to 1.0.0. - Handle unimplememnted function pointers causing errors. - Log lexical/semantic issues in headers as SEVERE. -# 0.3.0 +## 0.3.0 - Added support for including/excluding/renaming _un-named enums_ using key `unnamed_enums`. -# 0.2.4+1 +## 0.2.4+1 - Minor changes to dylib creation error log. -# 0.2.4 +## 0.2.4 - Added support for C booleans as Uint8. - Added config `dart-bool` (default: true) to use dart bool instead of int in function parameters and return type. -# 0.2.3+3 +## 0.2.3+3 - Wrapper dynamic library version now uses ffigen version from its pubspec.yaml file. -# 0.2.3+2 +## 0.2.3+2 - Handle code formatting using dartfmt by finding dart-sdk. -# 0.2.3+1 +## 0.2.3+1 - Fixed missing typedefs of nested function pointers. -# 0.2.3 +## 0.2.3 - Fixed parsing structs with bitfields, all members of structs with bit field members will now be removed. See [#84](https://github.com/dart-lang/ffigen/issues/84) -# 0.2.2+1 +## 0.2.2+1 - Updated `package:meta` version to `^1.1.8` for compatibility with flutter sdk. -# 0.2.2 +## 0.2.2 - Fixed multiple generation/skipping of typedef enclosed declarations. - Typedef names are now given higher preference over inner names, See [#83](https://github.com/dart-lang/ffigen/pull/83). -# 0.2.1+1 +## 0.2.1+1 - Added FAQ to readme. -# 0.2.1 +## 0.2.1 - Fixed missing/duplicate typedef generation. -# 0.2.0 +## 0.2.0 - Updated header config. Header `entry-points` and `include-directives` are now specified under `headers` key. Glob syntax is allowed. - Updated declaration `include`/`exclude` config. These are now specified as a list. - Added Regexp based declaration renaming using `rename` subkey. - Added Regexp based member renaming for structs, enums and functions using `member-rename` subkey. `prefix` and `prefix-replacement` subkeys have been removed. -# 0.1.5 +## 0.1.5 - Added support for parsing macros and anonymous unnamed enums. These are generated as top level constants. -# 0.1.4 +## 0.1.4 - Comments config now has a style and length sub keys - `style: doxygen(default) | any`, `length: brief | full(default)`, and can be disabled by passing `comments: false`. -# 0.1.3 +## 0.1.3 - Handled function arguments - dart keyword name collision - Fix travis tests: the dynamic library is created using `pub run ffigen:setup` before running the tests. -# 0.1.2 +## 0.1.2 - Fixed wrapper not found error when running `pub run ffigen`. -# 0.1.1 +## 0.1.1 - Address pub score: follow dart File conventions, provide documentation, and pass static analysis. -# 0.1.0 +## 0.1.0 - Support for Functions, Structs and Enums. - Glob support for specifying headers. - HeaderFilter - Include/Exclude declarations from specific header files using name matching. diff --git a/example/c_json/cjson_generated_bindings.dart b/example/c_json/cjson_generated_bindings.dart index 38bc263f..9ee0f813 100644 --- a/example/c_json/cjson_generated_bindings.dart +++ b/example/c_json/cjson_generated_bindings.dart @@ -73,9 +73,8 @@ class CJson { } late final _cJSON_ParsePtr = _lookup< - ffi - .NativeFunction Function(ffi.Pointer)>>( - 'cJSON_Parse'); + ffi.NativeFunction< + ffi.Pointer Function(ffi.Pointer)>>('cJSON_Parse'); late final _cJSON_Parse = _cJSON_ParsePtr .asFunction Function(ffi.Pointer)>(); @@ -110,9 +109,8 @@ class CJson { } late final _cJSON_PrintPtr = _lookup< - ffi - .NativeFunction Function(ffi.Pointer)>>( - 'cJSON_Print'); + ffi.NativeFunction< + ffi.Pointer Function(ffi.Pointer)>>('cJSON_Print'); late final _cJSON_Print = _cJSON_PrintPtr .asFunction Function(ffi.Pointer)>(); diff --git a/example/c_json/pubspec.yaml b/example/c_json/pubspec.yaml index c1277a89..f5438235 100644 --- a/example/c_json/pubspec.yaml +++ b/example/c_json/pubspec.yaml @@ -5,7 +5,7 @@ name: c_json_example environment: - sdk: ">=3.2.0-114.0.dev <4.0.0" + sdk: ">=3.2.0-210.4.beta <4.0.0" dependencies: ffi: ^2.0.1 diff --git a/example/ffinative/pubspec.yaml b/example/ffinative/pubspec.yaml index 7be76fc1..122e5b97 100644 --- a/example/ffinative/pubspec.yaml +++ b/example/ffinative/pubspec.yaml @@ -5,7 +5,7 @@ name: ffinative_example environment: - sdk: ">=3.2.0-114.0.dev <4.0.0" + sdk: ">=3.2.0-210.4.beta <4.0.0" dependencies: ffi: ^2.0.1 diff --git a/example/libclang-example/pubspec.yaml b/example/libclang-example/pubspec.yaml index a8ecc544..79860c77 100644 --- a/example/libclang-example/pubspec.yaml +++ b/example/libclang-example/pubspec.yaml @@ -5,7 +5,7 @@ name: libclang_example environment: - sdk: ">=3.2.0-114.0.dev <4.0.0" + sdk: ">=3.2.0-210.4.beta <4.0.0" dependencies: ffi: ^2.0.1 diff --git a/example/objective_c/avf_audio_bindings.dart b/example/objective_c/avf_audio_bindings.dart index eaa669d7..8d4936f8 100644 --- a/example/objective_c/avf_audio_bindings.dart +++ b/example/objective_c/avf_audio_bindings.dart @@ -22553,20 +22553,20 @@ class AVFAudio { ); } - late final __objc_msgSend_803Ptr = _lookup< - ffi.NativeFunction< - ffi.Pointer< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi - .Pointer< + late final __objc_msgSend_803Ptr = + _lookup< + ffi.NativeFunction< + ffi.Pointer< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Pointer, + ffi.Pointer< ffi.NativeFunction< NSUInteger Function( ffi.Pointer)>>, - ffi.Bool)>> - Function(ffi.Pointer, ffi.Pointer)>>( - 'objc_msgSend'); + ffi.Bool)>> + Function(ffi.Pointer, ffi.Pointer)>>( + 'objc_msgSend'); late final __objc_msgSend_803 = __objc_msgSend_803Ptr.asFunction< ffi.Pointer< ffi.NativeFunction< @@ -36092,17 +36092,16 @@ class ObjCBlock4 extends _ObjCBlockBase { NSUInteger arg1, ffi.Pointer arg2)>> ptr) : this._( - lib - ._newBlock1( - ffi.Pointer.fromFunction< - ffi.Bool Function( - ffi.Pointer<_ObjCBlock> block, - ffi.Pointer arg0, - NSUInteger arg1, - ffi.Pointer arg2)>( - _ObjCBlock4_fnPtrTrampoline, false) - .cast(), - ptr.cast()), + lib._newBlock1( + ffi.Pointer.fromFunction< + ffi.Bool Function( + ffi.Pointer<_ObjCBlock> block, + ffi.Pointer arg0, + NSUInteger arg1, + ffi.Pointer arg2)>( + _ObjCBlock4_fnPtrTrampoline, false) + .cast(), + ptr.cast()), lib); /// Creates a block from a Dart function. @@ -47404,16 +47403,15 @@ class ObjCBlock19 extends _ObjCBlockBase { ffi.Pointer arg1)>> ptr) : this._( - lib - ._newBlock1( - ffi.Pointer.fromFunction< - ffi.Void Function( - ffi.Pointer<_ObjCBlock> block, - ffi.Pointer arg0, - ffi.Pointer arg1)>( - _ObjCBlock19_fnPtrTrampoline) - .cast(), - ptr.cast()), + lib._newBlock1( + ffi.Pointer.fromFunction< + ffi.Void Function( + ffi.Pointer<_ObjCBlock> block, + ffi.Pointer arg0, + ffi.Pointer arg1)>( + _ObjCBlock19_fnPtrTrampoline) + .cast(), + ptr.cast()), lib); /// Creates a block from a Dart function. @@ -47562,8 +47560,7 @@ class ObjCBlock21 extends _ObjCBlockBase { ObjCBlock21.fromFunctionPointer( AVFAudio lib, ffi.Pointer< - ffi - .NativeFunction< + ffi.NativeFunction< ffi.Void Function(ffi.Pointer arg0, ffi.Bool arg1, ffi.Pointer arg2)>> ptr) @@ -47657,16 +47654,15 @@ class ObjCBlock22 extends _ObjCBlockBase { ffi.Pointer arg1)>> ptr) : this._( - lib - ._newBlock1( - ffi.Pointer.fromFunction< - ffi.Void Function( - ffi.Pointer<_ObjCBlock> block, - ffi.Pointer arg0, - ffi.Pointer arg1)>( - _ObjCBlock22_fnPtrTrampoline) - .cast(), - ptr.cast()), + lib._newBlock1( + ffi.Pointer.fromFunction< + ffi.Void Function( + ffi.Pointer<_ObjCBlock> block, + ffi.Pointer arg0, + ffi.Pointer arg1)>( + _ObjCBlock22_fnPtrTrampoline) + .cast(), + ptr.cast()), lib); /// Creates a block from a Dart function. @@ -47815,16 +47811,15 @@ class ObjCBlock24 extends _ObjCBlockBase { ffi.Pointer arg1)>> ptr) : this._( - lib - ._newBlock1( - ffi.Pointer.fromFunction< - ffi.Void Function( - ffi.Pointer<_ObjCBlock> block, - ffi.Pointer arg0, - ffi.Pointer arg1)>( - _ObjCBlock24_fnPtrTrampoline) - .cast(), - ptr.cast()), + lib._newBlock1( + ffi.Pointer.fromFunction< + ffi.Void Function( + ffi.Pointer<_ObjCBlock> block, + ffi.Pointer arg0, + ffi.Pointer arg1)>( + _ObjCBlock24_fnPtrTrampoline) + .cast(), + ptr.cast()), lib); /// Creates a block from a Dart function. @@ -62447,8 +62442,7 @@ class ObjCBlock39 extends _ObjCBlockBase { ObjCBlock39.fromFunctionPointer( AVFAudio lib, ffi.Pointer< - ffi - .NativeFunction< + ffi.NativeFunction< ffi.Void Function(ffi.Pointer arg0, ffi.Bool arg1, ffi.Pointer arg2)>> ptr) @@ -63112,16 +63106,15 @@ class ObjCBlock40 extends _ObjCBlockBase { ffi.Pointer arg1)>> ptr) : this._( - lib - ._newBlock1( - ffi.Pointer.fromFunction< - ffi.Void Function( - ffi.Pointer<_ObjCBlock> block, - ffi.Pointer arg0, - ffi.Pointer arg1)>( - _ObjCBlock40_fnPtrTrampoline) - .cast(), - ptr.cast()), + lib._newBlock1( + ffi.Pointer.fromFunction< + ffi.Void Function( + ffi.Pointer<_ObjCBlock> block, + ffi.Pointer arg0, + ffi.Pointer arg1)>( + _ObjCBlock40_fnPtrTrampoline) + .cast(), + ptr.cast()), lib); /// Creates a block from a Dart function. diff --git a/example/objective_c/pubspec.yaml b/example/objective_c/pubspec.yaml index c06b7a0a..354250a4 100644 --- a/example/objective_c/pubspec.yaml +++ b/example/objective_c/pubspec.yaml @@ -5,7 +5,7 @@ name: objective_c_example environment: - sdk: ">=3.2.0-114.0.dev <4.0.0" + sdk: ">=3.2.0-210.4.beta <4.0.0" dependencies: ffi: ^2.0.1 diff --git a/example/shared_bindings/pubspec.yaml b/example/shared_bindings/pubspec.yaml index 23008d23..005214cf 100644 --- a/example/shared_bindings/pubspec.yaml +++ b/example/shared_bindings/pubspec.yaml @@ -5,7 +5,7 @@ name: shared_bindings environment: - sdk: ">=3.2.0-114.0.dev <4.0.0" + sdk: ">=3.2.0-210.4.beta <4.0.0" dependencies: cli_util: ^0.4.0 diff --git a/example/simple/generated_bindings.dart b/example/simple/generated_bindings.dart index b26a8ac7..71f0414a 100644 --- a/example/simple/generated_bindings.dart +++ b/example/simple/generated_bindings.dart @@ -81,9 +81,8 @@ class NativeLibrary { } late final _dividePtr = _lookup< - ffi - .NativeFunction Function(ffi.Int, ffi.Int)>>( - 'divide'); + ffi.NativeFunction< + ffi.Pointer Function(ffi.Int, ffi.Int)>>('divide'); late final _divide = _dividePtr.asFunction Function(int, int)>(); diff --git a/example/simple/pubspec.yaml b/example/simple/pubspec.yaml index bef37902..67b34996 100644 --- a/example/simple/pubspec.yaml +++ b/example/simple/pubspec.yaml @@ -5,7 +5,7 @@ name: simple_example environment: - sdk: ">=3.2.0-114.0.dev <4.0.0" + sdk: ">=3.2.0-210.4.beta <4.0.0" dependencies: ffi: ^2.0.1 diff --git a/example/swift/swift_api_bindings.dart b/example/swift/swift_api_bindings.dart index 2a8783aa..9d19d79b 100644 --- a/example/swift/swift_api_bindings.dart +++ b/example/swift/swift_api_bindings.dart @@ -22558,20 +22558,20 @@ class SwiftLibrary { ); } - late final __objc_msgSend_803Ptr = _lookup< - ffi.NativeFunction< - ffi.Pointer< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi - .Pointer< + late final __objc_msgSend_803Ptr = + _lookup< + ffi.NativeFunction< + ffi.Pointer< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Pointer, + ffi.Pointer< ffi.NativeFunction< NSUInteger Function( ffi.Pointer)>>, - ffi.Bool)>> - Function(ffi.Pointer, ffi.Pointer)>>( - 'objc_msgSend'); + ffi.Bool)>> + Function(ffi.Pointer, ffi.Pointer)>>( + 'objc_msgSend'); late final __objc_msgSend_803 = __objc_msgSend_803Ptr.asFunction< ffi.Pointer< ffi.NativeFunction< @@ -34838,7 +34838,8 @@ class ObjCBlock4 extends _ObjCBlockBase { /// Creates a block from a C function pointer. ObjCBlock4.fromFunctionPointer( SwiftLibrary lib, - ffi.Pointer< + ffi + .Pointer< ffi .NativeFunction< ffi.Bool Function(ffi.Pointer arg0, @@ -46336,8 +46337,7 @@ class ObjCBlock21 extends _ObjCBlockBase { ObjCBlock21.fromFunctionPointer( SwiftLibrary lib, ffi.Pointer< - ffi - .NativeFunction< + ffi.NativeFunction< ffi.Void Function(ffi.Pointer arg0, ffi.Bool arg1, ffi.Pointer arg2)>> ptr) @@ -61245,8 +61245,7 @@ class ObjCBlock39 extends _ObjCBlockBase { ObjCBlock39.fromFunctionPointer( SwiftLibrary lib, ffi.Pointer< - ffi - .NativeFunction< + ffi.NativeFunction< ffi.Void Function(ffi.Pointer arg0, ffi.Bool arg1, ffi.Pointer arg2)>> ptr) diff --git a/pubspec.yaml b/pubspec.yaml index ae45a104..0e24c1c0 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -15,7 +15,7 @@ topics: - codegen environment: - sdk: ">=3.2.0-114.0.dev <4.0.0" + sdk: ">=3.2.0-210.4.beta <4.0.0" dependencies: ffi: ^2.0.1 diff --git a/test/code_generator_tests/expected_bindings/_expected_boolean_dartbool_bindings.dart b/test/code_generator_tests/expected_bindings/_expected_boolean_dartbool_bindings.dart index ff7dc120..015821ea 100644 --- a/test/code_generator_tests/expected_bindings/_expected_boolean_dartbool_bindings.dart +++ b/test/code_generator_tests/expected_bindings/_expected_boolean_dartbool_bindings.dart @@ -29,9 +29,8 @@ class Bindings { } late final _test1Ptr = _lookup< - ffi - .NativeFunction)>>( - 'test1'); + ffi.NativeFunction< + ffi.Bool Function(ffi.Bool, ffi.Pointer)>>('test1'); late final _test1 = _test1Ptr.asFunction)>(); } diff --git a/test/header_parser_tests/expected_bindings/_expected_functions_bindings.dart b/test/header_parser_tests/expected_bindings/_expected_functions_bindings.dart index 7b6682c4..7475b09d 100644 --- a/test/header_parser_tests/expected_bindings/_expected_functions_bindings.dart +++ b/test/header_parser_tests/expected_bindings/_expected_functions_bindings.dart @@ -128,9 +128,8 @@ class NativeLibrary { } late final _diffCharsPtr = _lookup< - ffi - .NativeFunction>( - 'diffChars'); + ffi.NativeFunction< + ffi.Char Function(ffi.UnsignedChar, ffi.SignedChar)>>('diffChars'); late final _diffChars = _diffCharsPtr.asFunction(); late final addresses = _SymbolAddresses(this); diff --git a/test/large_integration_tests/_expected_cjson_bindings.dart b/test/large_integration_tests/_expected_cjson_bindings.dart index cc66670e..9c5a3e10 100644 --- a/test/large_integration_tests/_expected_cjson_bindings.dart +++ b/test/large_integration_tests/_expected_cjson_bindings.dart @@ -54,9 +54,8 @@ class CJson { } late final _cJSON_ParsePtr = _lookup< - ffi - .NativeFunction Function(ffi.Pointer)>>( - 'cJSON_Parse'); + ffi.NativeFunction< + ffi.Pointer Function(ffi.Pointer)>>('cJSON_Parse'); late final _cJSON_Parse = _cJSON_ParsePtr .asFunction Function(ffi.Pointer)>(); @@ -91,9 +90,8 @@ class CJson { } late final _cJSON_PrintPtr = _lookup< - ffi - .NativeFunction Function(ffi.Pointer)>>( - 'cJSON_Print'); + ffi.NativeFunction< + ffi.Pointer Function(ffi.Pointer)>>('cJSON_Print'); late final _cJSON_Print = _cJSON_PrintPtr .asFunction Function(ffi.Pointer)>(); diff --git a/test/large_integration_tests/_expected_sqlite_bindings.dart b/test/large_integration_tests/_expected_sqlite_bindings.dart index 5c6de762..ae907ccb 100644 --- a/test/large_integration_tests/_expected_sqlite_bindings.dart +++ b/test/large_integration_tests/_expected_sqlite_bindings.dart @@ -4733,11 +4733,10 @@ class SQLite { ffi.Pointer, ffi.Int, ffi.Pointer>)>>, - ffi - .Pointer< - ffi.NativeFunction< - ffi.Void Function( - ffi.Pointer)>>)>>( + ffi.Pointer< + ffi.NativeFunction< + ffi.Void Function( + ffi.Pointer)>>)>>( 'sqlite3_create_function'); late final _sqlite3_create_function = _sqlite3_create_functionPtr.asFunction< int Function( @@ -4811,11 +4810,10 @@ class SQLite { ffi.Pointer, ffi.Int, ffi.Pointer>)>>, - ffi - .Pointer< - ffi.NativeFunction< - ffi.Void Function( - ffi.Pointer)>>)>>( + ffi.Pointer< + ffi.NativeFunction< + ffi.Void Function( + ffi.Pointer)>>)>>( 'sqlite3_create_function16'); late final _sqlite3_create_function16 = _sqlite3_create_function16Ptr.asFunction< @@ -4896,10 +4894,9 @@ class SQLite { ffi.Pointer< ffi.NativeFunction< ffi.Void Function(ffi.Pointer)>>, - ffi - .Pointer< - ffi.NativeFunction< - ffi.Void Function(ffi.Pointer)>>)>>( + ffi.Pointer< + ffi.NativeFunction< + ffi.Void Function(ffi.Pointer)>>)>>( 'sqlite3_create_function_v2'); late final _sqlite3_create_function_v2 = _sqlite3_create_function_v2Ptr.asFunction< @@ -4990,10 +4987,9 @@ class SQLite { ffi.Pointer, ffi.Int, ffi.Pointer>)>>, - ffi - .Pointer< - ffi.NativeFunction< - ffi.Void Function(ffi.Pointer)>>)>>( + ffi.Pointer< + ffi.NativeFunction< + ffi.Void Function(ffi.Pointer)>>)>>( 'sqlite3_create_window_function'); late final _sqlite3_create_window_function = _sqlite3_create_window_functionPtr.asFunction< @@ -9760,9 +9756,8 @@ class SQLite { } late final _sqlite3_logPtr = _lookup< - ffi - .NativeFunction)>>( - 'sqlite3_log'); + ffi.NativeFunction< + ffi.Void Function(ffi.Int, ffi.Pointer)>>('sqlite3_log'); late final _sqlite3_log = _sqlite3_logPtr.asFunction)>(); @@ -10706,8 +10701,7 @@ class SQLite { ffi.Pointer)>>, ffi.Pointer, ffi.Pointer< - ffi - .NativeFunction< + ffi.NativeFunction< ffi.Void Function(ffi.Pointer)>>)>>( 'sqlite3_rtree_query_callback'); late final _sqlite3_rtree_query_callback =