ffigen 16.1.0 
ffigen: ^16.1.0 copied to clipboard
Generator for FFI bindings, using LibClang to parse C, Objective-C, and Swift files.
16.1.0 #
- Ensure that required symbols are available to FFI even when the final binary
is linked with 
-dead_strip. - Handle dart typedefs in import/export of symbol files.
 - Add support for blocking ObjC blocks that can be invoked from any thread.
 - Add support for blocking ObjC protocol methods.
 - Remove explicit 
objc_retaincalls from the generated bindings. 
16.0.0 #
- Ensure all protocols referenced in bindings are available at runtime.
 - Use 
package:dart_styledirectly to format generated Dart code, rather than subprocessing todart format. - Use package:objective_c 4.0.0
 - Fix various small bugs todo with config filters:
 - Fix a bug where nullable typealiases were treated as non-null.
 - Allow static and instance methods to have the same name: https://github.com/dart-lang/native/issues/1136
 - Breaking change: Change the way ObjC categories are generated. Instead of
inserting their methods into the interface, generate Dart extension methods.
For instance methods this makes no difference to user code (as long as the
extension methods are imported correctly). But for static methods it means
MyInterface.staticMethodmust change toMyCategory.staticMethod. Categories are included/excluded by theobjc-categoriesconfig entry. - Add 
include-transitive-objc-interfaces,include-transitive-objc-protocols, andinclude-transitive-objc-categoriesconfig flags, which control whether transitively included ObjC interfaces, protocols, and categories are generated. - Breaking change: 
include-transitive-objc-interfacesdefaults to false, which changes the default behavior from pulling in all transitive deps, to generating them as stubs.include-transitive-objc-protocolsdefaults to false, andinclude-transitive-objc-categoriesdefaults to true, but these both replicate the existing behavior. - Fix bugs caused by mismatches between ObjC and Dart's inheritance rules.
 
15.0.0 #
- Bump minimum Dart version to 3.4.
 - Dedupe 
ObjCBlocktrampolines to reduce generated ObjC code. - Update to latest 
package:objective_c. - ObjC objects now include the methods from the protocols they implement. Both required and optional methods are included. Optional methods will throw an exception if the method isn't implemented.
 - Breaking change: Only generate ObjC protocol implementation bindings for
protocols that are included by the config filters. This is breaking because
previously super protocols would automatically get implementation bindings,
rather than just being incorporated into the child protocol. If you want those
implementation bindings, you may need to add the super protocol to your
objc-protocolsfilters. - Fix a bug where ObjC listener blocks could be deleted after being invoked by ObjC but before the invocation was received by Dart: https://github.com/dart-lang/native/issues/1571
 sort:config option now affects ObjC interface/protocol methods.- Fix a bug where 
NSRangewas not being imported from package:objective_c: https://github.com/dart-lang/native/issues/1180 - Breaking change: Return structs from ObjC methods by value instead of taking a struct return pointer.
 
14.0.1 #
- Fix bug with nullable types in 
ObjCBlock's type arguments: https://github.com/dart-lang/native/issues/1537 - Fix a path normalization bug: https://github.com/dart-lang/native/issues/1543
 
14.0.0 #
- Create a public facing API for ffigen that can be invoked as a library:
void generate(Config config). MakeConfigan implementatble interface, rather than needing to be parsed from yaml. - Add a 
external-versionsconfig option. Setting the minimum target version will omit APIs from the generated bindings if they were deprecated before this version. - Global variables using ObjC types (interfaces or blocks) will now use the correct Dart wrapper types, instead of the raw C-style pointers.
 - Rename 
assetIdunder ffi-native toasset-idto follow dash-case. - Breaking change: ObjC blocks are now passed through all ObjC APIs as
ObjCBlock<Ret Function(Args...)>, instead of the codegennedObjCBlock_...wrapper. The wrapper is now a non-constructible set of util methods for constructingObjCBlock. - Breaking change: Generated ObjC code has been migrated to ARC (Automatic
Reference Counting), and must now be compiled with ARC enabled. For example,
if you had a line like 
s.requires_arc = []in your podspec, this should either be removed, or you should add the ffigen generated ObjC code to the list. If you're compiling directly with clang, add the-fobjc-arcflag. - Breaking change: Structs with enum members now generate their members
as Dart enum values as well. For example, with an enum 
MyEnumand a struct with a memberMyEnum enumMember, two members are generated:enumMemberAsIntwhich contains the original integer value, andenumMember, which is of typeMyEnum. If you configure the enum to be generated as Dart integers, this new behavior will not apply, and the struct member will be an integer as well. - Breaking change: Enums generated as integers will now generate 
sealedclasses as opposed toabstractclasses. - Fix some bugs in the way ObjC method families and ownership annotations were being handled: https://github.com/dart-lang/native/issues/1446
 - Apply the existing 
member-renameoption to ObjC interface and protocol methods and properties. - Add a 
member-filteroption that filters ObjC interface and protocol methods and properties. 
13.0.0 #
- Breaking change: Code-gen the ObjC 
idtype toObjCObjectBaserather thanNSObject, since not all ObjC classes inherit fromNSObject. EgNSProxy. - Breaking change: Generate a native trampoline for each listener block, to
fix a ref counting bug: https://github.com/dart-lang/native/issues/835.
- If you have listener blocks affected by this ref count bug, a .m file will be generated containing the trampoline. You must compile this .m file into your package. If you already have a flutter plugin or build.dart, you can simply add this generated file to that build.
 - If you don't use listener blocks, you can ignore the .m file.
 - You can choose where the generated .m file is placed with the
output.objc-bindingsconfig option. 
 - Breaking change: Native enums are now generated as real Dart enums, instead
of abstract classes with integer constants. Native enum members with the same
integer values are handled properly on the Dart side, and native functions
that use enums in their signatures now accept the generated enums on the Dart
side, instead of integer values. To opt out of this, use the 
enums->as-intoption as specified in the README. - Breaking change: Enum integer types are implementation-defined and not
part of the ABI. Therefore FFIgen does a best-effort approach trying to mimic
the most common compilers for the various OS and architecture combinations.
To silence the warning set config 
silence-enum-warningtotrue. - Rename ObjC interface methods that clash with type names. Fixes https://github.com/dart-lang/native/issues/1007.
 - Added support for implementing ObjC protocols from Dart. Use the
objc-protocolsconfig option to generate bindings for a protocol. - Fix some bugs where ObjC interface/protocol methods could collide with Dart built-in methods, or with types declared elsewhere in the generated bindings.
 - Add 
include-unused-typedefsto allow generating typedefs that are not referred to anywhere, the default option isfalse. - Use 
package:dart_flutter_team_lints. 
12.0.0 #
- Global variables are now compatible with the 
ffi-nativeoption. - Exposing symbol addresses of functions and globals is now compatible with the
ffi-nativeoption. - Add 
retainAndReturnPointermethod to ObjC objects and blocks, and addcastFromPointermethod to blocks. - Add 
-Wno-nullability-completenessas default compiler option for MacOS. - Breaking change: Use 
package:objective_cin ObjC bindings.- ObjC packages will have a flutter dependency (until https://github.com/dart-lang/native/issues/1068 is fixed).
 - Core classes such as 
NSStringhave been moved intopackage:objective_c. - ObjC class methods don't need the ubiquitous 
libargument anymore. In fact, ffigen won't even generate the native library class (unless it needs to bind top level functions without using@Native). It is still necessary toDynamicLibrary.openthe dylib though, to load the classes and methods. - Adapting to this change:
- Update ffigen and re-run the code generation. If the generated code no
longer contains the native library class, it means it isn't needed
anymore. So 
final lib = FooNativeLib(DynamicLibrary.open('foo.dylib'));must be changed toDynamicLibrary.open('foo.dylib');. - Regardless of whether the native library class still exists, delete the
libparameter from all ObjC object constructors and static method calls and block constructors. - If core ObjC classes such as 
NSStringare being used,package:objective_cmust be imported, as they won't be exported by the generated bindings. 
 - Update ffigen and re-run the code generation. If the generated code no
longer contains the native library class, it means it isn't needed
anymore. So 
 
 - Add --[no-]format option to ffigen command line, which controls whether the formatting step happens. Defaults to true.
 - Delete Dart functions associated with ObjC closure blocks when the block is destroyed. Fixes https://github.com/dart-lang/native/issues/204
 - Reduce cursor definition not found logs when 
structs/unions->dependency-onlyis set toopaque. 
11.0.0 #
- Any compiler errors/warnings in source header files will now result in
bindings to not be generated by default, since it may result in invalid
bindings if the compiler makes a wrong guess. A flag 
--ignore-source-errors(or yaml configignore-source-errors: true) must be passed to change this behaviour. - Breaking change: Stop generating setters for global variables marked 
constin C. - Fix objc_msgSend being used on arm64 platforms where it's not available.
 - Fix missing comma with 
ffi-nativefunctions markedleaf. - Add support for finding libclang in Conda environment.
 
10.0.0 #
- Stable release targeting Dart 3.2 using new 
dart:ffifeatures available in Dart 3.2 and later. - Add support for ObjC Blocks that can be invoked from any thread, using NativeCallable.listener.
 - Fix invalid exceptional return value ObjCBlocks that return floats.
 - Fix return_of_invalid_type analysis error for ObjCBlocks.
 - Fix crash in ObjC methods and blocks that return structs by value.
 - Fix ObjC methods returning instancetype having the wrong type in sublasses.
 - When generating typedefs for 
Pointer<NativeFunction<Function>>, also generate a typedef for theFunction. - Use Dart wrapper types in args and returns of ObjCBlocks.
 - Use Dart wrapper types in args and returns of static functions.
 - Renamed 
assettoassetIdforffi-native. 
9.0.1 #
- Fix doc comment missing on struct/union array fields.
 - Allow extern inline functions to be generated.
 
9.0.0 #
- Added a JSON schema for FFIgen config files.
 
8.0.2 #
- Fixed invalid code generated due to zero-length arrays in structs/union.
 
8.0.1 #
- Fixed invalid code generated due to anonymous structs/unions with unsupported types.
 
8.0.0 #
- Stable release for Dart 3.0 with support for class modifers, variadic arguments, and 
@Natives. 
8.0.0-dev.3 #
- Added support for variadic functions using config 
functions -> variadic-arguments. 
8.0.0-dev.2 #
- Use 
@Nativesyntax instead of deprecated@FfiNativesyntax. 
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 #
- Adds 
finalclass modifier to generated sub typesStruct,UnionandOpaque. A class modifier is required in Dart 3.0 because the classesdart:ffias markedbase. When migrating a package that uses FFIgen, and exposes the generated code in the public API of the package, to Dart 3.0, that package does not need a major version bump. Sub typingStruct,UnionandOpaquesub types is already disallowed bydart:ffipre 3.0, so adding thefinalkeyword is not a breaking change. - Bumps SDK lowerbound to 3.0.
 
7.2.11 #
- Fix invalid struct/enum member references due to multiple anonymous struct/enum in a declaration.
 
7.2.10 #
- Generate parameter names in function pointer fields and typedefs.
 
7.2.9 #
- Detect LLVM installed using Scoop on Windows machines.
 
7.2.8 #
- Automatically generate 
ignore_for_file: type=lintif not specified in preamble. 
7.2.7 #
- Fix some macros not being generated in some cases due to relative header paths.
 
7.2.6 #
- Fix path normalization behaviour for absolute paths and globs starting with 
**. 
7.2.5 #
- Add support nested anonymous union/struct
 
7.2.4 #
- Add new supported typedef - 
uintptr_t(mapped toffi.UintPtr). 
7.2.3 #
- Change compiler option order so that user options can override built-in options.
 
7.2.2 #
- Added newer versions of LLVM, to default 
linuxDylibLocations. 
7.2.1 #
- Fix helper methods sometimes missing from NSString.
 
7.2.0 #
- Added support for sharing bindings using 
symbol-fileconfig. (SeeREADME.mdand examples/shared_bindings). 
7.1.0 #
- Handle declarations with definition accessible from a different entry-point.
 
7.0.0 #
- Fix typedef include/exclude config.
 - Return 
ObjCBlockwrapper instead of raw pointer in more cases. 
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 #
- Fix bug where function bindings were not deduped correctly.
 
6.1.1 #
- EXPERIMENTAL support for 
FfiNative. The API and output might change at any point. 
6.1.0 #
- Added 
exclude-all-by-defaultconfig flag, which changes the default behavior of declaration filters to exclude everything, rather than include everything. 
6.0.2 #
- Bump 
package:ffito 2.0.1. 
6.0.1 #
- Replace path separators in 
include-directivesbefore matching file names. - Add more ways to find 
libclang. 
6.0.0 #
- Removed config 
dart-bool. Booleans are now always generated withboolandffi.Boolas it's Dart and C Type respectively. 
5.0.1 #
- Add a the xcode tools llvm as default path on MacOS.
 
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 #
- Fixed invalid default dart types being generated for 
size_tandwchar_t. 
5.0.0-dev.0 #
- Added support for generating ABI Specific integers.
 - Breaking: removed config keys - 
size-mapandtypedef-map. - Added config keys - 
library-importsandtype-map. 
4.1.3 #
- Analyzer fixes.
 
4.1.2 #
- Added fix for empty include list to exclude all
 
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 #
- Add config key 
functions -> leaffor specifyingisLeaf:truefor functions. 
4.0.0 #
- Release for Dart SDK 
>=2.14. 
4.0.0-dev.2 #
- Added config key 
functions -> expose-typedefsto expose the typedef to Native and Dart type. - Config key 
function->symbol-addressno longer exposes the typedef to Native type. Useexpose-typedefsto get the native type. 
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, lintRule2in thepreamble, or rename the symbols to make package:lints happy. - Name collisions are now resolved by suffixing 
<int>instead of_<int>. 
4.0.0-dev.0 #
- Added support for generating typedefs (referred typedefs only).
 
| Example C Code | Generated Dart typedef | 
 | 
 | 
- All declarations that are excluded by the user are now only included if being used somewhere.
 - Improved struct/union include/exclude. These declarations can now be targetted 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 #
- Users can now specify exact path to dynamic library in 
llvm-path. 
3.1.0-dev.0 #
- Added support for generating unions.
 
3.0.0 #
- Release for dart sdk 
>=2.13(Support for packed structs and inline arrays). 
3.0.0-beta.0 #
- Added support for inline arrays in 
Structs. - Remove config key 
array-workaround. - Remove deprecated key 
llvm-libfrom config, Usellvm-pathinstead. 
2.5.0-beta.1 #
- Added support for 
Packedstructs. Packed annotations are generated automatically but can be overriden usingstructs -> packconfig. - Updated sdk constraints to 
>=2.13.0-211.6.beta. 
2.4.2 #
- Fix issues due to declarations having duplicate names.
 - Fix name conflict of declaration with ffi library prefix.
 - Fix 
charnot being recognized on platforms where it's unsigned by default. 
2.4.1 #
- Added 
/usr/libto default dynamic library location for linux. 
2.4.0 #
- Added new config key 
llvm-paththat accepts a list ofpath/to/llvm. - Deprecated config key 
llvm-lib. 
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 #
- Added new command line flag 
--compiler-optsto the command line tool. 
2.2.4 #
- Fix 
sort: truenot working. - Fix extra 
//or///in comments when usingcomments -> style:full. 
2.2.3 #
- Added new subkey 
dependency-only(options -full (default) | opaque) understructs. When set toopaque, ffigen will generate emptyOpaquestructs if structs were excluded in config (i.e added because they were a dependency) and only passed by reference(pointer). 
2.2.2 #
- Fixed generation of empty opaque structs due to forward declarations in header files.
 
2.2.1 #
- Fixed generation of duplicate constants suffixed with 
_<int>when using multiple entry points. 
2.2.0 #
- Added subkey 
symbol-addressto expose native symbol pointers forfunctionsandglobals. 
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 #
- Ignore typedef to struct pointer when possible.
 - Recursively create directories for output file.
 
2.0.2 #
- Fixed illegal use of 
constin name, crash due to unnamed inline structs and structs havingOpaquemembers. 
2.0.1 #
- Switch to preview release of 
package:quiver. 
2.0.0 #
- Upgraded all dependencies. 
package:ffigennow runs with sound null safety. 
2.0.0-dev.6 #
- Functions marked 
inlineare now skipped. 
2.0.0-dev.5 #
- Use 
Opaquefor representing emptyStructs. 
2.0.0-dev.4 #
- Add support for parsing and generating globals.
 
2.0.0-dev.3 #
- Removed the usage of 
--no-sound-null-safetyflag. 
2.0.0-dev.2 #
- Removed setup phase for ffigen. Added new optional config key 
llvm-libto specify path tollvm/libfolder. 
2.0.0-dev.1 #
- Added support for passing and returning struct by value in functions.
 
2.0.0-dev.0 #
- Added support for Nested structs.
 
2.0.0-nullsafety.1 #
- Removed the need for 
--no-sound-null-safetyflag. 
2.0.0-nullsafety.0 #
- Migrated to (unsound) null safety.
 
1.2.0 #
- Added support for 
Dart_Handlefromdart_api.h. 
1.1.0 #
typedef-mapcan now be used to map a typedef name to a native type directly.
1.0.6 #
- Fixed missing typedefs nested in another typedef's return types.
 
1.0.5 #
- Fixed issues with generating macros of type 
double.Infinityanddouble.NaN. 
1.0.4 #
- Updated code to use 
dart formatinstead ofdartfmtfor sdk version>= 2.10.0. 
1.0.3 #
- Fixed errors due to extended ASCII and control characters in macro strings.
 
1.0.2 #
- Fix indentation for pub's readme.
 
1.0.1 #
- Fixed generation of 
NativeFunctionparameters instead ofPointer<NativeFunction>in type signatures. 
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 #
- Added support for including/excluding/renaming un-named enums using key 
unnamed_enums. 
0.2.4+1 #
- Minor changes to dylib creation error log.
 
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 #
- Wrapper dynamic library version now uses ffigen version from its pubspec.yaml file.
 
0.2.3+2 #
- Handle code formatting using dartfmt by finding dart-sdk.
 
0.2.3+1 #
- Fixed missing typedefs of nested function pointers.
 
0.2.3 #
- Fixed parsing structs with bitfields, all members of structs with bit field members will now be removed. See #84
 
0.2.2+1 #
- Updated 
package:metaversion to^1.1.8for compatibility with flutter sdk. 
0.2.2 #
- Fixed multiple generation/skipping of typedef enclosed declarations.
 - Typedef names are now given higher preference over inner names, See #83.
 
0.2.1+1 #
- Added FAQ to readme.
 
0.2.1 #
- Fixed missing/duplicate typedef generation.
 
0.2.0 #
- Updated header config. Header 
entry-pointsandinclude-directivesare now specified underheaderskey. Glob syntax is allowed. - Updated declaration 
include/excludeconfig. These are now specified as a list. - Added Regexp based declaration renaming using 
renamesubkey. - Added Regexp based member renaming for structs, enums and functions using 
member-renamesubkey.prefixandprefix-replacementsubkeys have been removed. 
0.1.5 #
- Added support for parsing macros and anonymous unnamed enums. These are generated as top level constants.
 
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 passingcomments: false. 
0.1.3 #
- Handled function arguments - dart keyword name collision
 - Fix travis tests: the dynamic library is created using 
pub run ffigen:setupbefore running the tests. 
0.1.2 #
- Fixed wrapper not found error when running 
pub run ffigen. 
0.1.1 #
- Address pub score: follow dart File conventions, provide documentation, and pass static analysis.
 
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.
 - Filters - Include/Exclude function, structs and enum declarations using Regexp or Name matching.
 - Prefixing - function, structs and enums can have a global prefix. Individual prefix Replacement support using Regexp.
 - Comment extraction: full/brief/none
 - Support for fixed size arrays in struct. 
array-workaround(if enabled) will generate helpers for accessing fixed size arrays in structs. - Size for ints can be specified using 
size-mapin config. - Options to disable using supported typedefs (e.g 
uint8_t => Uint8), sort bindings. - Option to add a raw 
preamblewhich is included as is in the generated file.