Skip to content

ffigen-v20.0.0

Choose a tag to compare

@liamappelbe liamappelbe released this 07 Nov 00:32
· 16 commits to main since this release
8215af2
  • Breaking change: Completely rewrite the public Dart API for FFIgen.
    The new API is focused on a declartive configuration: FfiGenerate(...) with
    a generate() method. The configuration describes everything w.r.t. to the
    FFIgen input and output. The generate method takes context parameters such as
    a logger and path to libclang.
    With this breaking change, also some defaults changed: (1) @Native bindings
    are now the default, and (2) struct/unions refered to by pointer will be
    generated as Opaque by default.
  • Breaking change: Rename some ObjC interface built in methods. Rename
    isInstance to isA, castFrom to as, and castFromPointer to
    fromPointer.
  • Breaking change: Change ObjC interfaces and protocols to generate as
    extension types. This gives a
    small performance boost, and in most cases won't require any code changes.
  • Breaking change: Change how ObjC protocols are generated, splitting the
    methods related to constructing instances into a separate Foo$Builder class.
    The protocol's instance methods are now directly invokable from the built
    object.
  • Breaking change: Minor breaking change in the way that ObjC interface
    methods are generated. Interface methods are now generated as extension
    methods instead of being part of the class. This shouldn't require any code
    changes unless you are using show or hide when importing the interface.
    • If you are using show/hide to show or hide a particular interface, eg
      Foo, you'll now also need to show or hide Foo$Methods.
    • In rare cases the runtime type of the Dart wrapper object around the ObjC
      object may change, but the underlying ObjC object will still be the same.
      In any case, you should be using Foo.isInstance(x) instead of x is Foo
      to check the runtime type of an ObjC object.
  • Breaking change: Minor breaking change where ObjC enums declared using
    NS_OPTIONS now default to generating int constants instead of a Dart enum.
    Users who cared about this distinction were likely already using
    enums.as-int for these enums. This change just provides a better default
    behavior, so is unlikely to cause any substantive code changes.
  • Breaking_change: The name collision resolution system has been overhauled
    to fix various bugs, and make the renaming more consistent. As a result, in
    some cases different names may be chosen when resolving collisions.
  • Breaking_change: Detect the ObjC error raising pattern, where the last
    param is NSError** error, capture any error returned, and throw it as a Dart
    NSErrorException.
  • Fix for opaque dependencies for struct/union const arrays.
  • Make the Logger argument of FfiGenerator.generate optional. It defaults to
    a logger printing to stdout and stderr.