[ffigen] Add an integration test for objective C (#293)

* Add an integration test for objective C

* Switch CI to use test/setup.dart

* Trying to fix CI

* Report generated file
diff --git a/pkgs/ffigen/.github/workflows/test-package.yml b/pkgs/ffigen/.github/workflows/test-package.yml
index 67a6c95..90e290e 100644
--- a/pkgs/ffigen/.github/workflows/test-package.yml
+++ b/pkgs/ffigen/.github/workflows/test-package.yml
@@ -49,7 +49,7 @@
       - name: Install libclang-10-dev
         run: sudo apt-get install libclang-10-dev
       - name: Build test dylib
-        run: cd test/native_test && dart build_test_dylib.dart && cd ../..
+        run: dart test/setup.dart
       - name: Run VM tests
         run: dart test --platform vm
       - name: Collect coverage
@@ -71,7 +71,7 @@
       - name: Install dependencies
         run: dart pub get
       - name: Build test dylib
-        run: cd test/native_test && dart build_test_dylib.dart && cd ../..
+        run: dart test/setup.dart
       - name: Run VM tests
         run: dart test --platform vm
       - name: Collect coverage
diff --git a/pkgs/ffigen/README.md b/pkgs/ffigen/README.md
index 3665b12..bc718b8 100644
--- a/pkgs/ffigen/README.md
+++ b/pkgs/ffigen/README.md
@@ -509,9 +509,8 @@
 2. Run `dart run ffigen`.
 
 ## Running Tests
-1. Dynamic library for some tests need to be built before running the examples.
-  1. `cd test/native_test`.
-  2. Run `dart build_test_dylib.dart`.
+Dynamic library for some tests need to be built before running the examples.
+Run `dart test/setup.dart` to build the libraries.
 
 Run tests from the root of the package with `dart run test`.
 > Note: If llvm is not installed in one of the default locations, tests may fail.
diff --git a/pkgs/ffigen/lib/src/code_generator/binding.dart b/pkgs/ffigen/lib/src/code_generator/binding.dart
index 105d6f0..2e2f189 100644
--- a/pkgs/ffigen/lib/src/code_generator/binding.dart
+++ b/pkgs/ffigen/lib/src/code_generator/binding.dart
@@ -19,12 +19,14 @@
   String name;
 
   final String? dartDoc;
+  final bool isInternal;
 
   Binding({
     required this.usr,
     required this.originalName,
     required this.name,
     this.dartDoc,
+    this.isInternal = false,
   });
 
   /// Get all dependencies, including itself and save them in [dependencies].
@@ -44,11 +46,13 @@
     String? originalName,
     required String name,
     String? dartDoc,
+    bool isInternal = false,
   }) : super(
           usr: usr ?? name,
           originalName: originalName ?? name,
           name: name,
           dartDoc: dartDoc,
+          isInternal: isInternal,
         );
 }
 
@@ -59,10 +63,12 @@
     String? originalName,
     required String name,
     String? dartDoc,
+    bool isInternal = false,
   }) : super(
           usr: usr ?? name,
           originalName: originalName ?? name,
           name: name,
           dartDoc: dartDoc,
+          isInternal: isInternal,
         );
 }
diff --git a/pkgs/ffigen/lib/src/code_generator/func.dart b/pkgs/ffigen/lib/src/code_generator/func.dart
index 815c303..2f64de1 100644
--- a/pkgs/ffigen/lib/src/code_generator/func.dart
+++ b/pkgs/ffigen/lib/src/code_generator/func.dart
@@ -48,6 +48,7 @@
     this.exposeSymbolAddress = false,
     this.exposeFunctionTypedefs = false,
     this.isLeaf = false,
+    bool isInternal = false,
   })  : functionType = FunctionType(
           returnType: returnType,
           parameters: parameters ?? const [],
@@ -57,6 +58,7 @@
           originalName: originalName,
           name: name,
           dartDoc: dartDoc,
+          isInternal: isInternal,
         ) {
     for (var i = 0; i < functionType.parameters.length; i++) {
       if (functionType.parameters[i].name.trim() == '') {
diff --git a/pkgs/ffigen/lib/src/code_generator/library.dart b/pkgs/ffigen/lib/src/code_generator/library.dart
index e00215c..87eb9de 100644
--- a/pkgs/ffigen/lib/src/code_generator/library.dart
+++ b/pkgs/ffigen/lib/src/code_generator/library.dart
@@ -90,7 +90,7 @@
 
   /// Logs a warning if generated declaration will be private.
   void _warnIfPrivateDeclaration(Binding b) {
-    if (b.name.startsWith('_')) {
+    if (b.name.startsWith('_') && !b.isInternal) {
       _logger.warning(
           "Generated declaration '${b.name}' start's with '_' and therefore will be private.");
     }
diff --git a/pkgs/ffigen/lib/src/code_generator/objc_interface.dart b/pkgs/ffigen/lib/src/code_generator/objc_interface.dart
index 2372485..3425a07 100644
--- a/pkgs/ffigen/lib/src/code_generator/objc_interface.dart
+++ b/pkgs/ffigen/lib/src/code_generator/objc_interface.dart
@@ -34,6 +34,7 @@
     originalName: 'sel_registerName',
     returnType: PointerType(objCSelType),
     parameters: [Parameter(name: 'str', type: PointerType(charType))],
+    isInternal: true,
   );
   late final String registerName;
 
@@ -42,6 +43,7 @@
     originalName: 'objc_getClass',
     returnType: PointerType(objCObjectType),
     parameters: [Parameter(name: 'str', type: PointerType(charType))],
+    isInternal: true,
   );
   late final String getClass;
 
@@ -62,6 +64,7 @@
         Parameter(name: 'sel', type: PointerType(objCSelType)),
         for (final p in params) Parameter(name: p.name, type: p.type),
       ],
+      isInternal: true,
     );
     return _msgSendFuncs[key]!;
   }
@@ -175,9 +178,12 @@
       }
       s.write('  ');
       if (isStatic) s.write('static ');
-      s.write('${_getConvertedType(m.returnType!, w, name)} ');
+      if (m.kind == ObjCMethodKind.propertySetter) {
+        s.write('set ');
+      } else {
+        s.write('${_getConvertedType(m.returnType!, w, name)} ');
+      }
       if (m.kind == ObjCMethodKind.propertyGetter) s.write('get ');
-      if (m.kind == ObjCMethodKind.propertySetter) s.write('set ');
       s.write(methodName);
       if (m.kind != ObjCMethodKind.propertyGetter) {
         s.write('(');
diff --git a/pkgs/ffigen/test/header_parser_tests/expected_bindings/_expected_objc_interface_bindings.dart b/pkgs/ffigen/test/header_parser_tests/expected_bindings/_expected_objc_interface_bindings.dart
index e584704..6342aad 100644
--- a/pkgs/ffigen/test/header_parser_tests/expected_bindings/_expected_objc_interface_bindings.dart
+++ b/pkgs/ffigen/test/header_parser_tests/expected_bindings/_expected_objc_interface_bindings.dart
@@ -569,7 +569,7 @@
   }
 
   static ffi.Pointer<ObjCSel>? _sel_someProperty1;
-  void set someProperty(int value) {
+  set someProperty(int value) {
     _sel_someProperty1 ??= _registerName(_lib, "setSomeProperty:");
     return _lib._objc_msgSend_22(_id, _sel_someProperty1!, value);
   }
diff --git a/pkgs/ffigen/test/native_objc_test/config.yaml b/pkgs/ffigen/test/native_objc_test/config.yaml
new file mode 100644
index 0000000..d7bb002
--- /dev/null
+++ b/pkgs/ffigen/test/native_objc_test/config.yaml
@@ -0,0 +1,17 @@
+# Copyright (c) 2022, 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.
+
+# =================== GENERATING TEST BINDINGS ==================
+#    dart run ffigen --config test/native_objc_test/config.yaml
+# ===============================================================
+
+name: NativeObjCLibrary
+description: 'Native Objective C test'
+language: objc
+output: 'test/native_objc_test/native_objc_test_bindings.dart'
+headers:
+  entry-points:
+    - 'test/native_objc_test/native_objc_test.m'
+preamble: |
+  // ignore_for_file: camel_case_types, non_constant_identifier_names, unused_element, unused_field
diff --git a/pkgs/ffigen/test/native_objc_test/native_objc_test.dart b/pkgs/ffigen/test/native_objc_test/native_objc_test.dart
new file mode 100644
index 0000000..9f2e219
--- /dev/null
+++ b/pkgs/ffigen/test/native_objc_test/native_objc_test.dart
@@ -0,0 +1,62 @@
+// Copyright (c) 2022, 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.
+
+// Objective C support is only available on mac.
+@TestOn('mac-os')
+
+import 'dart:ffi';
+import 'dart:io';
+
+import 'package:ffigen/ffigen.dart';
+import 'package:path/path.dart' as path;
+import 'package:test/test.dart';
+import 'package:yaml/yaml.dart';
+import '../test_utils.dart';
+import 'native_objc_test_bindings.dart';
+
+void main() {
+  late NativeObjCLibrary lib;
+  group('native_objc_test', () {
+    setUpAll(() {
+      logWarnings();
+      lib = NativeObjCLibrary(DynamicLibrary.open(
+          File('test/native_objc_test/native_objc_test.dylib').absolute.path));
+    });
+
+    test('generate_bindings', () {
+      final config = Config.fromYaml(loadYaml(
+          File(path.join('test', 'native_objc_test', 'config.yaml'))
+              .readAsStringSync()) as YamlMap);
+      final library = parse(config);
+      final file = File(
+        path.join('test', 'debug_generated', 'native_objc_test_bindings.dart'),
+      );
+      library.generateFile(file);
+
+      try {
+        final actual = file.readAsStringSync();
+        final expected = File(path.join(config.output)).readAsStringSync();
+        expect(actual, expected);
+        if (file.existsSync()) {
+          file.delete();
+        }
+      } catch (e) {
+        print('Failed test: Debug generated file: ${file.absolute.path}');
+        rethrow;
+      }
+    });
+
+    test('Interface basics, with Foo', () {
+      final foo1 = Foo.makeFoo(lib, 3.14159);
+      final foo2 = Foo.makeFoo(lib, 2.71828);
+      expect(foo1.intVal, 3);
+      expect(foo2.intVal, 2);
+      expect(foo1.multiply(0, foo2), 8);
+      expect(foo1.multiply(1, foo2), 6);
+      foo1.intVal = 100;
+      expect(foo1.multiply(0, foo2), 8);
+      expect(foo1.multiply(1, foo2), 200);
+    });
+  });
+}
diff --git a/pkgs/ffigen/test/native_objc_test/native_objc_test.m b/pkgs/ffigen/test/native_objc_test/native_objc_test.m
new file mode 100644
index 0000000..98f9aca
--- /dev/null
+++ b/pkgs/ffigen/test/native_objc_test/native_objc_test.m
@@ -0,0 +1,32 @@
+#import <Foundation/NSObject.h>
+
+@interface Foo : NSObject {
+  double doubleVal;
+}
+
+@property int32_t intVal;
+
++ (Foo*)makeFoo:(double)x;
+
+- (int32_t)multiply:(BOOL)useIntVals withOtherFoo:(Foo*)other;
+
+@end
+
+@implementation Foo
+
++ (Foo*)makeFoo:(double)x {
+  Foo* foo = [Foo new];
+  foo->doubleVal = x;
+  [foo setIntVal:((int32_t)x)];
+  return foo;
+}
+
+- (int32_t)multiply:(BOOL)useIntVals withOtherFoo:(Foo*)other {
+  if (useIntVals) {
+    return [self intVal] * [other intVal];
+  } else {
+    return (int32_t)(self->doubleVal * other->doubleVal);
+  }
+}
+
+@end
diff --git a/pkgs/ffigen/test/native_objc_test/native_objc_test_bindings.dart b/pkgs/ffigen/test/native_objc_test/native_objc_test_bindings.dart
new file mode 100644
index 0000000..9c86588
--- /dev/null
+++ b/pkgs/ffigen/test/native_objc_test/native_objc_test_bindings.dart
@@ -0,0 +1,2285 @@
+// ignore_for_file: camel_case_types, non_constant_identifier_names, unused_element, unused_field
+
+// AUTO GENERATED FILE, DO NOT EDIT.
+//
+// Generated by `package:ffigen`.
+import 'dart:ffi' as ffi;
+import 'package:ffi/ffi.dart' as pkg_ffi;
+
+/// Native Objective C test
+class NativeObjCLibrary {
+  /// Holds the symbol lookup function.
+  final ffi.Pointer<T> Function<T extends ffi.NativeType>(String symbolName)
+      _lookup;
+
+  /// The symbols are looked up in [dynamicLibrary].
+  NativeObjCLibrary(ffi.DynamicLibrary dynamicLibrary)
+      : _lookup = dynamicLibrary.lookup;
+
+  /// The symbols are looked up with [lookup].
+  NativeObjCLibrary.fromLookup(
+      ffi.Pointer<T> Function<T extends ffi.NativeType>(String symbolName)
+          lookup)
+      : _lookup = lookup;
+
+  late final ffi.Pointer<ffi.Double> _NSFoundationVersionNumber =
+      _lookup<ffi.Double>('NSFoundationVersionNumber');
+
+  double get NSFoundationVersionNumber => _NSFoundationVersionNumber.value;
+
+  set NSFoundationVersionNumber(double value) =>
+      _NSFoundationVersionNumber.value = value;
+
+  ffi.Pointer<ObjCObject> NSStringFromSelector(
+    ffi.Pointer<ObjCSel> aSelector,
+  ) {
+    return _NSStringFromSelector(
+      aSelector,
+    );
+  }
+
+  late final _NSStringFromSelectorPtr = _lookup<
+      ffi.NativeFunction<
+          ffi.Pointer<ObjCObject> Function(
+              ffi.Pointer<ObjCSel>)>>('NSStringFromSelector');
+  late final _NSStringFromSelector = _NSStringFromSelectorPtr.asFunction<
+      ffi.Pointer<ObjCObject> Function(ffi.Pointer<ObjCSel>)>();
+
+  ffi.Pointer<ObjCSel> NSSelectorFromString(
+    ffi.Pointer<ObjCObject> aSelectorName,
+  ) {
+    return _NSSelectorFromString(
+      aSelectorName,
+    );
+  }
+
+  late final _NSSelectorFromStringPtr = _lookup<
+      ffi.NativeFunction<
+          ffi.Pointer<ObjCSel> Function(
+              ffi.Pointer<ObjCObject>)>>('NSSelectorFromString');
+  late final _NSSelectorFromString = _NSSelectorFromStringPtr.asFunction<
+      ffi.Pointer<ObjCSel> Function(ffi.Pointer<ObjCObject>)>();
+
+  ffi.Pointer<ObjCObject> NSStringFromClass(
+    ffi.Pointer<ObjCObject> aClass,
+  ) {
+    return _NSStringFromClass(
+      aClass,
+    );
+  }
+
+  late final _NSStringFromClassPtr = _lookup<
+      ffi.NativeFunction<
+          ffi.Pointer<ObjCObject> Function(
+              ffi.Pointer<ObjCObject>)>>('NSStringFromClass');
+  late final _NSStringFromClass = _NSStringFromClassPtr.asFunction<
+      ffi.Pointer<ObjCObject> Function(ffi.Pointer<ObjCObject>)>();
+
+  ffi.Pointer<ObjCObject> NSClassFromString(
+    ffi.Pointer<ObjCObject> aClassName,
+  ) {
+    return _NSClassFromString(
+      aClassName,
+    );
+  }
+
+  late final _NSClassFromStringPtr = _lookup<
+      ffi.NativeFunction<
+          ffi.Pointer<ObjCObject> Function(
+              ffi.Pointer<ObjCObject>)>>('NSClassFromString');
+  late final _NSClassFromString = _NSClassFromStringPtr.asFunction<
+      ffi.Pointer<ObjCObject> Function(ffi.Pointer<ObjCObject>)>();
+
+  ffi.Pointer<ObjCObject> NSStringFromProtocol(
+    ffi.Pointer<ObjCObject> proto,
+  ) {
+    return _NSStringFromProtocol(
+      proto,
+    );
+  }
+
+  late final _NSStringFromProtocolPtr = _lookup<
+      ffi.NativeFunction<
+          ffi.Pointer<ObjCObject> Function(
+              ffi.Pointer<ObjCObject>)>>('NSStringFromProtocol');
+  late final _NSStringFromProtocol = _NSStringFromProtocolPtr.asFunction<
+      ffi.Pointer<ObjCObject> Function(ffi.Pointer<ObjCObject>)>();
+
+  ffi.Pointer<ObjCObject> NSProtocolFromString(
+    ffi.Pointer<ObjCObject> namestr,
+  ) {
+    return _NSProtocolFromString(
+      namestr,
+    );
+  }
+
+  late final _NSProtocolFromStringPtr = _lookup<
+      ffi.NativeFunction<
+          ffi.Pointer<ObjCObject> Function(
+              ffi.Pointer<ObjCObject>)>>('NSProtocolFromString');
+  late final _NSProtocolFromString = _NSProtocolFromStringPtr.asFunction<
+      ffi.Pointer<ObjCObject> Function(ffi.Pointer<ObjCObject>)>();
+
+  ffi.Pointer<pkg_ffi.Char> NSGetSizeAndAlignment(
+    ffi.Pointer<pkg_ffi.Char> typePtr,
+    ffi.Pointer<NSUInteger> sizep,
+    ffi.Pointer<NSUInteger> alignp,
+  ) {
+    return _NSGetSizeAndAlignment(
+      typePtr,
+      sizep,
+      alignp,
+    );
+  }
+
+  late final _NSGetSizeAndAlignmentPtr = _lookup<
+      ffi.NativeFunction<
+          ffi.Pointer<pkg_ffi.Char> Function(
+              ffi.Pointer<pkg_ffi.Char>,
+              ffi.Pointer<NSUInteger>,
+              ffi.Pointer<NSUInteger>)>>('NSGetSizeAndAlignment');
+  late final _NSGetSizeAndAlignment = _NSGetSizeAndAlignmentPtr.asFunction<
+      ffi.Pointer<pkg_ffi.Char> Function(ffi.Pointer<pkg_ffi.Char>,
+          ffi.Pointer<NSUInteger>, ffi.Pointer<NSUInteger>)>();
+
+  void NSLog(
+    ffi.Pointer<ObjCObject> format,
+  ) {
+    return _NSLog(
+      format,
+    );
+  }
+
+  late final _NSLogPtr =
+      _lookup<ffi.NativeFunction<ffi.Void Function(ffi.Pointer<ObjCObject>)>>(
+          'NSLog');
+  late final _NSLog =
+      _NSLogPtr.asFunction<void Function(ffi.Pointer<ObjCObject>)>();
+
+  void NSLogv(
+    ffi.Pointer<ObjCObject> format,
+    ffi.Pointer<__va_list_tag> args,
+  ) {
+    return _NSLogv(
+      format,
+      args,
+    );
+  }
+
+  late final _NSLogvPtr = _lookup<
+      ffi.NativeFunction<
+          ffi.Void Function(
+              ffi.Pointer<ObjCObject>, ffi.Pointer<__va_list_tag>)>>('NSLogv');
+  late final _NSLogv = _NSLogvPtr.asFunction<
+      void Function(ffi.Pointer<ObjCObject>, ffi.Pointer<__va_list_tag>)>();
+
+  late final ffi.Pointer<NSInteger> _NSNotFound =
+      _lookup<NSInteger>('NSNotFound');
+
+  int get NSNotFound => _NSNotFound.value;
+
+  set NSNotFound(int value) => _NSNotFound.value = value;
+
+  late final ffi.Pointer<ffi.Double> _kCFCoreFoundationVersionNumber =
+      _lookup<ffi.Double>('kCFCoreFoundationVersionNumber');
+
+  double get kCFCoreFoundationVersionNumber =>
+      _kCFCoreFoundationVersionNumber.value;
+
+  set kCFCoreFoundationVersionNumber(double value) =>
+      _kCFCoreFoundationVersionNumber.value = value;
+
+  late final ffi.Pointer<CFIndex> _kCFNotFound =
+      _lookup<CFIndex>('kCFNotFound');
+
+  int get kCFNotFound => _kCFNotFound.value;
+
+  set kCFNotFound(int value) => _kCFNotFound.value = value;
+
+  CFRange __CFRangeMake(
+    int loc,
+    int len,
+  ) {
+    return ___CFRangeMake(
+      loc,
+      len,
+    );
+  }
+
+  late final ___CFRangeMakePtr =
+      _lookup<ffi.NativeFunction<CFRange Function(CFIndex, CFIndex)>>(
+          '__CFRangeMake');
+  late final ___CFRangeMake =
+      ___CFRangeMakePtr.asFunction<CFRange Function(int, int)>();
+
+  int CFNullGetTypeID() {
+    return _CFNullGetTypeID();
+  }
+
+  late final _CFNullGetTypeIDPtr =
+      _lookup<ffi.NativeFunction<CFTypeID Function()>>('CFNullGetTypeID');
+  late final _CFNullGetTypeID =
+      _CFNullGetTypeIDPtr.asFunction<int Function()>();
+
+  late final ffi.Pointer<CFNullRef> _kCFNull = _lookup<CFNullRef>('kCFNull');
+
+  CFNullRef get kCFNull => _kCFNull.value;
+
+  set kCFNull(CFNullRef value) => _kCFNull.value = value;
+
+  late final ffi.Pointer<CFAllocatorRef> _kCFAllocatorDefault =
+      _lookup<CFAllocatorRef>('kCFAllocatorDefault');
+
+  CFAllocatorRef get kCFAllocatorDefault => _kCFAllocatorDefault.value;
+
+  set kCFAllocatorDefault(CFAllocatorRef value) =>
+      _kCFAllocatorDefault.value = value;
+
+  late final ffi.Pointer<CFAllocatorRef> _kCFAllocatorSystemDefault =
+      _lookup<CFAllocatorRef>('kCFAllocatorSystemDefault');
+
+  CFAllocatorRef get kCFAllocatorSystemDefault =>
+      _kCFAllocatorSystemDefault.value;
+
+  set kCFAllocatorSystemDefault(CFAllocatorRef value) =>
+      _kCFAllocatorSystemDefault.value = value;
+
+  late final ffi.Pointer<CFAllocatorRef> _kCFAllocatorMalloc =
+      _lookup<CFAllocatorRef>('kCFAllocatorMalloc');
+
+  CFAllocatorRef get kCFAllocatorMalloc => _kCFAllocatorMalloc.value;
+
+  set kCFAllocatorMalloc(CFAllocatorRef value) =>
+      _kCFAllocatorMalloc.value = value;
+
+  late final ffi.Pointer<CFAllocatorRef> _kCFAllocatorMallocZone =
+      _lookup<CFAllocatorRef>('kCFAllocatorMallocZone');
+
+  CFAllocatorRef get kCFAllocatorMallocZone => _kCFAllocatorMallocZone.value;
+
+  set kCFAllocatorMallocZone(CFAllocatorRef value) =>
+      _kCFAllocatorMallocZone.value = value;
+
+  late final ffi.Pointer<CFAllocatorRef> _kCFAllocatorNull =
+      _lookup<CFAllocatorRef>('kCFAllocatorNull');
+
+  CFAllocatorRef get kCFAllocatorNull => _kCFAllocatorNull.value;
+
+  set kCFAllocatorNull(CFAllocatorRef value) => _kCFAllocatorNull.value = value;
+
+  late final ffi.Pointer<CFAllocatorRef> _kCFAllocatorUseContext =
+      _lookup<CFAllocatorRef>('kCFAllocatorUseContext');
+
+  CFAllocatorRef get kCFAllocatorUseContext => _kCFAllocatorUseContext.value;
+
+  set kCFAllocatorUseContext(CFAllocatorRef value) =>
+      _kCFAllocatorUseContext.value = value;
+
+  int CFAllocatorGetTypeID() {
+    return _CFAllocatorGetTypeID();
+  }
+
+  late final _CFAllocatorGetTypeIDPtr =
+      _lookup<ffi.NativeFunction<CFTypeID Function()>>('CFAllocatorGetTypeID');
+  late final _CFAllocatorGetTypeID =
+      _CFAllocatorGetTypeIDPtr.asFunction<int Function()>();
+
+  void CFAllocatorSetDefault(
+    CFAllocatorRef allocator,
+  ) {
+    return _CFAllocatorSetDefault(
+      allocator,
+    );
+  }
+
+  late final _CFAllocatorSetDefaultPtr =
+      _lookup<ffi.NativeFunction<ffi.Void Function(CFAllocatorRef)>>(
+          'CFAllocatorSetDefault');
+  late final _CFAllocatorSetDefault =
+      _CFAllocatorSetDefaultPtr.asFunction<void Function(CFAllocatorRef)>();
+
+  CFAllocatorRef CFAllocatorGetDefault() {
+    return _CFAllocatorGetDefault();
+  }
+
+  late final _CFAllocatorGetDefaultPtr =
+      _lookup<ffi.NativeFunction<CFAllocatorRef Function()>>(
+          'CFAllocatorGetDefault');
+  late final _CFAllocatorGetDefault =
+      _CFAllocatorGetDefaultPtr.asFunction<CFAllocatorRef Function()>();
+
+  CFAllocatorRef CFAllocatorCreate(
+    CFAllocatorRef allocator,
+    ffi.Pointer<CFAllocatorContext> context,
+  ) {
+    return _CFAllocatorCreate(
+      allocator,
+      context,
+    );
+  }
+
+  late final _CFAllocatorCreatePtr = _lookup<
+      ffi.NativeFunction<
+          CFAllocatorRef Function(CFAllocatorRef,
+              ffi.Pointer<CFAllocatorContext>)>>('CFAllocatorCreate');
+  late final _CFAllocatorCreate = _CFAllocatorCreatePtr.asFunction<
+      CFAllocatorRef Function(
+          CFAllocatorRef, ffi.Pointer<CFAllocatorContext>)>();
+
+  ffi.Pointer<ffi.Void> CFAllocatorAllocate(
+    CFAllocatorRef allocator,
+    int size,
+    int hint,
+  ) {
+    return _CFAllocatorAllocate(
+      allocator,
+      size,
+      hint,
+    );
+  }
+
+  late final _CFAllocatorAllocatePtr = _lookup<
+      ffi.NativeFunction<
+          ffi.Pointer<ffi.Void> Function(
+              CFAllocatorRef, CFIndex, CFOptionFlags)>>('CFAllocatorAllocate');
+  late final _CFAllocatorAllocate = _CFAllocatorAllocatePtr.asFunction<
+      ffi.Pointer<ffi.Void> Function(CFAllocatorRef, int, int)>();
+
+  ffi.Pointer<ffi.Void> CFAllocatorReallocate(
+    CFAllocatorRef allocator,
+    ffi.Pointer<ffi.Void> ptr,
+    int newsize,
+    int hint,
+  ) {
+    return _CFAllocatorReallocate(
+      allocator,
+      ptr,
+      newsize,
+      hint,
+    );
+  }
+
+  late final _CFAllocatorReallocatePtr = _lookup<
+      ffi.NativeFunction<
+          ffi.Pointer<ffi.Void> Function(CFAllocatorRef, ffi.Pointer<ffi.Void>,
+              CFIndex, CFOptionFlags)>>('CFAllocatorReallocate');
+  late final _CFAllocatorReallocate = _CFAllocatorReallocatePtr.asFunction<
+      ffi.Pointer<ffi.Void> Function(
+          CFAllocatorRef, ffi.Pointer<ffi.Void>, int, int)>();
+
+  void CFAllocatorDeallocate(
+    CFAllocatorRef allocator,
+    ffi.Pointer<ffi.Void> ptr,
+  ) {
+    return _CFAllocatorDeallocate(
+      allocator,
+      ptr,
+    );
+  }
+
+  late final _CFAllocatorDeallocatePtr = _lookup<
+      ffi.NativeFunction<
+          ffi.Void Function(
+              CFAllocatorRef, ffi.Pointer<ffi.Void>)>>('CFAllocatorDeallocate');
+  late final _CFAllocatorDeallocate = _CFAllocatorDeallocatePtr.asFunction<
+      void Function(CFAllocatorRef, ffi.Pointer<ffi.Void>)>();
+
+  int CFAllocatorGetPreferredSizeForSize(
+    CFAllocatorRef allocator,
+    int size,
+    int hint,
+  ) {
+    return _CFAllocatorGetPreferredSizeForSize(
+      allocator,
+      size,
+      hint,
+    );
+  }
+
+  late final _CFAllocatorGetPreferredSizeForSizePtr = _lookup<
+      ffi.NativeFunction<
+          CFIndex Function(CFAllocatorRef, CFIndex,
+              CFOptionFlags)>>('CFAllocatorGetPreferredSizeForSize');
+  late final _CFAllocatorGetPreferredSizeForSize =
+      _CFAllocatorGetPreferredSizeForSizePtr.asFunction<
+          int Function(CFAllocatorRef, int, int)>();
+
+  void CFAllocatorGetContext(
+    CFAllocatorRef allocator,
+    ffi.Pointer<CFAllocatorContext> context,
+  ) {
+    return _CFAllocatorGetContext(
+      allocator,
+      context,
+    );
+  }
+
+  late final _CFAllocatorGetContextPtr = _lookup<
+      ffi.NativeFunction<
+          ffi.Void Function(CFAllocatorRef,
+              ffi.Pointer<CFAllocatorContext>)>>('CFAllocatorGetContext');
+  late final _CFAllocatorGetContext = _CFAllocatorGetContextPtr.asFunction<
+      void Function(CFAllocatorRef, ffi.Pointer<CFAllocatorContext>)>();
+
+  int CFGetTypeID(
+    CFTypeRef cf,
+  ) {
+    return _CFGetTypeID(
+      cf,
+    );
+  }
+
+  late final _CFGetTypeIDPtr =
+      _lookup<ffi.NativeFunction<CFTypeID Function(CFTypeRef)>>('CFGetTypeID');
+  late final _CFGetTypeID =
+      _CFGetTypeIDPtr.asFunction<int Function(CFTypeRef)>();
+
+  CFStringRef CFCopyTypeIDDescription(
+    int type_id,
+  ) {
+    return _CFCopyTypeIDDescription(
+      type_id,
+    );
+  }
+
+  late final _CFCopyTypeIDDescriptionPtr =
+      _lookup<ffi.NativeFunction<CFStringRef Function(CFTypeID)>>(
+          'CFCopyTypeIDDescription');
+  late final _CFCopyTypeIDDescription =
+      _CFCopyTypeIDDescriptionPtr.asFunction<CFStringRef Function(int)>();
+
+  CFTypeRef CFRetain(
+    CFTypeRef cf,
+  ) {
+    return _CFRetain(
+      cf,
+    );
+  }
+
+  late final _CFRetainPtr =
+      _lookup<ffi.NativeFunction<CFTypeRef Function(CFTypeRef)>>('CFRetain');
+  late final _CFRetain =
+      _CFRetainPtr.asFunction<CFTypeRef Function(CFTypeRef)>();
+
+  void CFRelease(
+    CFTypeRef cf,
+  ) {
+    return _CFRelease(
+      cf,
+    );
+  }
+
+  late final _CFReleasePtr =
+      _lookup<ffi.NativeFunction<ffi.Void Function(CFTypeRef)>>('CFRelease');
+  late final _CFRelease = _CFReleasePtr.asFunction<void Function(CFTypeRef)>();
+
+  CFTypeRef CFAutorelease(
+    CFTypeRef arg,
+  ) {
+    return _CFAutorelease(
+      arg,
+    );
+  }
+
+  late final _CFAutoreleasePtr =
+      _lookup<ffi.NativeFunction<CFTypeRef Function(CFTypeRef)>>(
+          'CFAutorelease');
+  late final _CFAutorelease =
+      _CFAutoreleasePtr.asFunction<CFTypeRef Function(CFTypeRef)>();
+
+  int CFGetRetainCount(
+    CFTypeRef cf,
+  ) {
+    return _CFGetRetainCount(
+      cf,
+    );
+  }
+
+  late final _CFGetRetainCountPtr =
+      _lookup<ffi.NativeFunction<CFIndex Function(CFTypeRef)>>(
+          'CFGetRetainCount');
+  late final _CFGetRetainCount =
+      _CFGetRetainCountPtr.asFunction<int Function(CFTypeRef)>();
+
+  int CFEqual(
+    CFTypeRef cf1,
+    CFTypeRef cf2,
+  ) {
+    return _CFEqual(
+      cf1,
+      cf2,
+    );
+  }
+
+  late final _CFEqualPtr =
+      _lookup<ffi.NativeFunction<Boolean Function(CFTypeRef, CFTypeRef)>>(
+          'CFEqual');
+  late final _CFEqual =
+      _CFEqualPtr.asFunction<int Function(CFTypeRef, CFTypeRef)>();
+
+  int CFHash(
+    CFTypeRef cf,
+  ) {
+    return _CFHash(
+      cf,
+    );
+  }
+
+  late final _CFHashPtr =
+      _lookup<ffi.NativeFunction<CFHashCode Function(CFTypeRef)>>('CFHash');
+  late final _CFHash = _CFHashPtr.asFunction<int Function(CFTypeRef)>();
+
+  CFStringRef CFCopyDescription(
+    CFTypeRef cf,
+  ) {
+    return _CFCopyDescription(
+      cf,
+    );
+  }
+
+  late final _CFCopyDescriptionPtr =
+      _lookup<ffi.NativeFunction<CFStringRef Function(CFTypeRef)>>(
+          'CFCopyDescription');
+  late final _CFCopyDescription =
+      _CFCopyDescriptionPtr.asFunction<CFStringRef Function(CFTypeRef)>();
+
+  CFAllocatorRef CFGetAllocator(
+    CFTypeRef cf,
+  ) {
+    return _CFGetAllocator(
+      cf,
+    );
+  }
+
+  late final _CFGetAllocatorPtr =
+      _lookup<ffi.NativeFunction<CFAllocatorRef Function(CFTypeRef)>>(
+          'CFGetAllocator');
+  late final _CFGetAllocator =
+      _CFGetAllocatorPtr.asFunction<CFAllocatorRef Function(CFTypeRef)>();
+
+  CFTypeRef CFMakeCollectable(
+    CFTypeRef cf,
+  ) {
+    return _CFMakeCollectable(
+      cf,
+    );
+  }
+
+  late final _CFMakeCollectablePtr =
+      _lookup<ffi.NativeFunction<CFTypeRef Function(CFTypeRef)>>(
+          'CFMakeCollectable');
+  late final _CFMakeCollectable =
+      _CFMakeCollectablePtr.asFunction<CFTypeRef Function(CFTypeRef)>();
+
+  ffi.Pointer<NSZone> NSDefaultMallocZone() {
+    return _NSDefaultMallocZone();
+  }
+
+  late final _NSDefaultMallocZonePtr =
+      _lookup<ffi.NativeFunction<ffi.Pointer<NSZone> Function()>>(
+          'NSDefaultMallocZone');
+  late final _NSDefaultMallocZone =
+      _NSDefaultMallocZonePtr.asFunction<ffi.Pointer<NSZone> Function()>();
+
+  ffi.Pointer<NSZone> NSCreateZone(
+    int startSize,
+    int granularity,
+    int canFree,
+  ) {
+    return _NSCreateZone(
+      startSize,
+      granularity,
+      canFree,
+    );
+  }
+
+  late final _NSCreateZonePtr = _lookup<
+      ffi.NativeFunction<
+          ffi.Pointer<NSZone> Function(
+              NSUInteger, NSUInteger, BOOL)>>('NSCreateZone');
+  late final _NSCreateZone = _NSCreateZonePtr.asFunction<
+      ffi.Pointer<NSZone> Function(int, int, int)>();
+
+  void NSRecycleZone(
+    ffi.Pointer<NSZone> zone,
+  ) {
+    return _NSRecycleZone(
+      zone,
+    );
+  }
+
+  late final _NSRecycleZonePtr =
+      _lookup<ffi.NativeFunction<ffi.Void Function(ffi.Pointer<NSZone>)>>(
+          'NSRecycleZone');
+  late final _NSRecycleZone =
+      _NSRecycleZonePtr.asFunction<void Function(ffi.Pointer<NSZone>)>();
+
+  void NSSetZoneName(
+    ffi.Pointer<NSZone> zone,
+    ffi.Pointer<ObjCObject> name,
+  ) {
+    return _NSSetZoneName(
+      zone,
+      name,
+    );
+  }
+
+  late final _NSSetZoneNamePtr = _lookup<
+      ffi.NativeFunction<
+          ffi.Void Function(
+              ffi.Pointer<NSZone>, ffi.Pointer<ObjCObject>)>>('NSSetZoneName');
+  late final _NSSetZoneName = _NSSetZoneNamePtr.asFunction<
+      void Function(ffi.Pointer<NSZone>, ffi.Pointer<ObjCObject>)>();
+
+  ffi.Pointer<ObjCObject> NSZoneName(
+    ffi.Pointer<NSZone> zone,
+  ) {
+    return _NSZoneName(
+      zone,
+    );
+  }
+
+  late final _NSZoneNamePtr = _lookup<
+      ffi.NativeFunction<
+          ffi.Pointer<ObjCObject> Function(ffi.Pointer<NSZone>)>>('NSZoneName');
+  late final _NSZoneName = _NSZoneNamePtr.asFunction<
+      ffi.Pointer<ObjCObject> Function(ffi.Pointer<NSZone>)>();
+
+  ffi.Pointer<NSZone> NSZoneFromPointer(
+    ffi.Pointer<ffi.Void> ptr,
+  ) {
+    return _NSZoneFromPointer(
+      ptr,
+    );
+  }
+
+  late final _NSZoneFromPointerPtr = _lookup<
+      ffi.NativeFunction<
+          ffi.Pointer<NSZone> Function(
+              ffi.Pointer<ffi.Void>)>>('NSZoneFromPointer');
+  late final _NSZoneFromPointer = _NSZoneFromPointerPtr.asFunction<
+      ffi.Pointer<NSZone> Function(ffi.Pointer<ffi.Void>)>();
+
+  ffi.Pointer<ffi.Void> NSZoneMalloc(
+    ffi.Pointer<NSZone> zone,
+    int size,
+  ) {
+    return _NSZoneMalloc(
+      zone,
+      size,
+    );
+  }
+
+  late final _NSZoneMallocPtr = _lookup<
+      ffi.NativeFunction<
+          ffi.Pointer<ffi.Void> Function(
+              ffi.Pointer<NSZone>, NSUInteger)>>('NSZoneMalloc');
+  late final _NSZoneMalloc = _NSZoneMallocPtr.asFunction<
+      ffi.Pointer<ffi.Void> Function(ffi.Pointer<NSZone>, int)>();
+
+  ffi.Pointer<ffi.Void> NSZoneCalloc(
+    ffi.Pointer<NSZone> zone,
+    int numElems,
+    int byteSize,
+  ) {
+    return _NSZoneCalloc(
+      zone,
+      numElems,
+      byteSize,
+    );
+  }
+
+  late final _NSZoneCallocPtr = _lookup<
+      ffi.NativeFunction<
+          ffi.Pointer<ffi.Void> Function(
+              ffi.Pointer<NSZone>, NSUInteger, NSUInteger)>>('NSZoneCalloc');
+  late final _NSZoneCalloc = _NSZoneCallocPtr.asFunction<
+      ffi.Pointer<ffi.Void> Function(ffi.Pointer<NSZone>, int, int)>();
+
+  ffi.Pointer<ffi.Void> NSZoneRealloc(
+    ffi.Pointer<NSZone> zone,
+    ffi.Pointer<ffi.Void> ptr,
+    int size,
+  ) {
+    return _NSZoneRealloc(
+      zone,
+      ptr,
+      size,
+    );
+  }
+
+  late final _NSZoneReallocPtr = _lookup<
+      ffi.NativeFunction<
+          ffi.Pointer<ffi.Void> Function(ffi.Pointer<NSZone>,
+              ffi.Pointer<ffi.Void>, NSUInteger)>>('NSZoneRealloc');
+  late final _NSZoneRealloc = _NSZoneReallocPtr.asFunction<
+      ffi.Pointer<ffi.Void> Function(
+          ffi.Pointer<NSZone>, ffi.Pointer<ffi.Void>, int)>();
+
+  void NSZoneFree(
+    ffi.Pointer<NSZone> zone,
+    ffi.Pointer<ffi.Void> ptr,
+  ) {
+    return _NSZoneFree(
+      zone,
+      ptr,
+    );
+  }
+
+  late final _NSZoneFreePtr = _lookup<
+      ffi.NativeFunction<
+          ffi.Void Function(
+              ffi.Pointer<NSZone>, ffi.Pointer<ffi.Void>)>>('NSZoneFree');
+  late final _NSZoneFree = _NSZoneFreePtr.asFunction<
+      void Function(ffi.Pointer<NSZone>, ffi.Pointer<ffi.Void>)>();
+
+  ffi.Pointer<ffi.Void> NSAllocateCollectable(
+    int size,
+    int options,
+  ) {
+    return _NSAllocateCollectable(
+      size,
+      options,
+    );
+  }
+
+  late final _NSAllocateCollectablePtr = _lookup<
+      ffi.NativeFunction<
+          ffi.Pointer<ffi.Void> Function(
+              NSUInteger, NSUInteger)>>('NSAllocateCollectable');
+  late final _NSAllocateCollectable = _NSAllocateCollectablePtr.asFunction<
+      ffi.Pointer<ffi.Void> Function(int, int)>();
+
+  ffi.Pointer<ffi.Void> NSReallocateCollectable(
+    ffi.Pointer<ffi.Void> ptr,
+    int size,
+    int options,
+  ) {
+    return _NSReallocateCollectable(
+      ptr,
+      size,
+      options,
+    );
+  }
+
+  late final _NSReallocateCollectablePtr = _lookup<
+      ffi.NativeFunction<
+          ffi.Pointer<ffi.Void> Function(ffi.Pointer<ffi.Void>, NSUInteger,
+              NSUInteger)>>('NSReallocateCollectable');
+  late final _NSReallocateCollectable = _NSReallocateCollectablePtr.asFunction<
+      ffi.Pointer<ffi.Void> Function(ffi.Pointer<ffi.Void>, int, int)>();
+
+  int NSPageSize() {
+    return _NSPageSize();
+  }
+
+  late final _NSPageSizePtr =
+      _lookup<ffi.NativeFunction<NSUInteger Function()>>('NSPageSize');
+  late final _NSPageSize = _NSPageSizePtr.asFunction<int Function()>();
+
+  int NSLogPageSize() {
+    return _NSLogPageSize();
+  }
+
+  late final _NSLogPageSizePtr =
+      _lookup<ffi.NativeFunction<NSUInteger Function()>>('NSLogPageSize');
+  late final _NSLogPageSize = _NSLogPageSizePtr.asFunction<int Function()>();
+
+  int NSRoundUpToMultipleOfPageSize(
+    int bytes,
+  ) {
+    return _NSRoundUpToMultipleOfPageSize(
+      bytes,
+    );
+  }
+
+  late final _NSRoundUpToMultipleOfPageSizePtr =
+      _lookup<ffi.NativeFunction<NSUInteger Function(NSUInteger)>>(
+          'NSRoundUpToMultipleOfPageSize');
+  late final _NSRoundUpToMultipleOfPageSize =
+      _NSRoundUpToMultipleOfPageSizePtr.asFunction<int Function(int)>();
+
+  int NSRoundDownToMultipleOfPageSize(
+    int bytes,
+  ) {
+    return _NSRoundDownToMultipleOfPageSize(
+      bytes,
+    );
+  }
+
+  late final _NSRoundDownToMultipleOfPageSizePtr =
+      _lookup<ffi.NativeFunction<NSUInteger Function(NSUInteger)>>(
+          'NSRoundDownToMultipleOfPageSize');
+  late final _NSRoundDownToMultipleOfPageSize =
+      _NSRoundDownToMultipleOfPageSizePtr.asFunction<int Function(int)>();
+
+  ffi.Pointer<ffi.Void> NSAllocateMemoryPages(
+    int bytes,
+  ) {
+    return _NSAllocateMemoryPages(
+      bytes,
+    );
+  }
+
+  late final _NSAllocateMemoryPagesPtr =
+      _lookup<ffi.NativeFunction<ffi.Pointer<ffi.Void> Function(NSUInteger)>>(
+          'NSAllocateMemoryPages');
+  late final _NSAllocateMemoryPages = _NSAllocateMemoryPagesPtr.asFunction<
+      ffi.Pointer<ffi.Void> Function(int)>();
+
+  void NSDeallocateMemoryPages(
+    ffi.Pointer<ffi.Void> ptr,
+    int bytes,
+  ) {
+    return _NSDeallocateMemoryPages(
+      ptr,
+      bytes,
+    );
+  }
+
+  late final _NSDeallocateMemoryPagesPtr = _lookup<
+      ffi.NativeFunction<
+          ffi.Void Function(
+              ffi.Pointer<ffi.Void>, NSUInteger)>>('NSDeallocateMemoryPages');
+  late final _NSDeallocateMemoryPages = _NSDeallocateMemoryPagesPtr.asFunction<
+      void Function(ffi.Pointer<ffi.Void>, int)>();
+
+  void NSCopyMemoryPages(
+    ffi.Pointer<ffi.Void> source,
+    ffi.Pointer<ffi.Void> dest,
+    int bytes,
+  ) {
+    return _NSCopyMemoryPages(
+      source,
+      dest,
+      bytes,
+    );
+  }
+
+  late final _NSCopyMemoryPagesPtr = _lookup<
+      ffi.NativeFunction<
+          ffi.Void Function(ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>,
+              NSUInteger)>>('NSCopyMemoryPages');
+  late final _NSCopyMemoryPages = _NSCopyMemoryPagesPtr.asFunction<
+      void Function(ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>, int)>();
+
+  int NSRealMemoryAvailable() {
+    return _NSRealMemoryAvailable();
+  }
+
+  late final _NSRealMemoryAvailablePtr =
+      _lookup<ffi.NativeFunction<NSUInteger Function()>>(
+          'NSRealMemoryAvailable');
+  late final _NSRealMemoryAvailable =
+      _NSRealMemoryAvailablePtr.asFunction<int Function()>();
+
+  ffi.Pointer<ObjCObject> NSAllocateObject(
+    ffi.Pointer<ObjCObject> aClass,
+    int extraBytes,
+    ffi.Pointer<NSZone> zone,
+  ) {
+    return _NSAllocateObject(
+      aClass,
+      extraBytes,
+      zone,
+    );
+  }
+
+  late final _NSAllocateObjectPtr = _lookup<
+      ffi.NativeFunction<
+          ffi.Pointer<ObjCObject> Function(ffi.Pointer<ObjCObject>, NSUInteger,
+              ffi.Pointer<NSZone>)>>('NSAllocateObject');
+  late final _NSAllocateObject = _NSAllocateObjectPtr.asFunction<
+      ffi.Pointer<ObjCObject> Function(
+          ffi.Pointer<ObjCObject>, int, ffi.Pointer<NSZone>)>();
+
+  void NSDeallocateObject(
+    ffi.Pointer<ObjCObject> object,
+  ) {
+    return _NSDeallocateObject(
+      object,
+    );
+  }
+
+  late final _NSDeallocateObjectPtr =
+      _lookup<ffi.NativeFunction<ffi.Void Function(ffi.Pointer<ObjCObject>)>>(
+          'NSDeallocateObject');
+  late final _NSDeallocateObject = _NSDeallocateObjectPtr.asFunction<
+      void Function(ffi.Pointer<ObjCObject>)>();
+
+  ffi.Pointer<ObjCObject> NSCopyObject(
+    ffi.Pointer<ObjCObject> object,
+    int extraBytes,
+    ffi.Pointer<NSZone> zone,
+  ) {
+    return _NSCopyObject(
+      object,
+      extraBytes,
+      zone,
+    );
+  }
+
+  late final _NSCopyObjectPtr = _lookup<
+      ffi.NativeFunction<
+          ffi.Pointer<ObjCObject> Function(ffi.Pointer<ObjCObject>, NSUInteger,
+              ffi.Pointer<NSZone>)>>('NSCopyObject');
+  late final _NSCopyObject = _NSCopyObjectPtr.asFunction<
+      ffi.Pointer<ObjCObject> Function(
+          ffi.Pointer<ObjCObject>, int, ffi.Pointer<NSZone>)>();
+
+  int NSShouldRetainWithZone(
+    ffi.Pointer<ObjCObject> anObject,
+    ffi.Pointer<NSZone> requestedZone,
+  ) {
+    return _NSShouldRetainWithZone(
+      anObject,
+      requestedZone,
+    );
+  }
+
+  late final _NSShouldRetainWithZonePtr = _lookup<
+      ffi.NativeFunction<
+          BOOL Function(ffi.Pointer<ObjCObject>,
+              ffi.Pointer<NSZone>)>>('NSShouldRetainWithZone');
+  late final _NSShouldRetainWithZone = _NSShouldRetainWithZonePtr.asFunction<
+      int Function(ffi.Pointer<ObjCObject>, ffi.Pointer<NSZone>)>();
+
+  void NSIncrementExtraRefCount(
+    ffi.Pointer<ObjCObject> object,
+  ) {
+    return _NSIncrementExtraRefCount(
+      object,
+    );
+  }
+
+  late final _NSIncrementExtraRefCountPtr =
+      _lookup<ffi.NativeFunction<ffi.Void Function(ffi.Pointer<ObjCObject>)>>(
+          'NSIncrementExtraRefCount');
+  late final _NSIncrementExtraRefCount = _NSIncrementExtraRefCountPtr
+      .asFunction<void Function(ffi.Pointer<ObjCObject>)>();
+
+  int NSDecrementExtraRefCountWasZero(
+    ffi.Pointer<ObjCObject> object,
+  ) {
+    return _NSDecrementExtraRefCountWasZero(
+      object,
+    );
+  }
+
+  late final _NSDecrementExtraRefCountWasZeroPtr =
+      _lookup<ffi.NativeFunction<BOOL Function(ffi.Pointer<ObjCObject>)>>(
+          'NSDecrementExtraRefCountWasZero');
+  late final _NSDecrementExtraRefCountWasZero =
+      _NSDecrementExtraRefCountWasZeroPtr.asFunction<
+          int Function(ffi.Pointer<ObjCObject>)>();
+
+  int NSExtraRefCount(
+    ffi.Pointer<ObjCObject> object,
+  ) {
+    return _NSExtraRefCount(
+      object,
+    );
+  }
+
+  late final _NSExtraRefCountPtr =
+      _lookup<ffi.NativeFunction<NSUInteger Function(ffi.Pointer<ObjCObject>)>>(
+          'NSExtraRefCount');
+  late final _NSExtraRefCount =
+      _NSExtraRefCountPtr.asFunction<int Function(ffi.Pointer<ObjCObject>)>();
+
+  ffi.Pointer<ObjCSel> _sel_registerName(
+    ffi.Pointer<pkg_ffi.Char> str,
+  ) {
+    return __sel_registerName(
+      str,
+    );
+  }
+
+  late final __sel_registerNamePtr = _lookup<
+      ffi.NativeFunction<
+          ffi.Pointer<ObjCSel> Function(
+              ffi.Pointer<pkg_ffi.Char>)>>('sel_registerName');
+  late final __sel_registerName = __sel_registerNamePtr
+      .asFunction<ffi.Pointer<ObjCSel> Function(ffi.Pointer<pkg_ffi.Char>)>();
+
+  ffi.Pointer<ObjCObject> _objc_getClass(
+    ffi.Pointer<pkg_ffi.Char> str,
+  ) {
+    return __objc_getClass(
+      str,
+    );
+  }
+
+  late final __objc_getClassPtr = _lookup<
+      ffi.NativeFunction<
+          ffi.Pointer<ObjCObject> Function(
+              ffi.Pointer<pkg_ffi.Char>)>>('objc_getClass');
+  late final __objc_getClass = __objc_getClassPtr.asFunction<
+      ffi.Pointer<ObjCObject> Function(ffi.Pointer<pkg_ffi.Char>)>();
+
+  instancetype _objc_msgSend_0(
+    ffi.Pointer<ObjCObject> obj,
+    ffi.Pointer<ObjCSel> sel,
+  ) {
+    return __objc_msgSend_0(
+      obj,
+      sel,
+    );
+  }
+
+  late final __objc_msgSend_0Ptr = _lookup<
+      ffi.NativeFunction<
+          instancetype Function(
+              ffi.Pointer<ObjCObject>, ffi.Pointer<ObjCSel>)>>('objc_msgSend');
+  late final __objc_msgSend_0 = __objc_msgSend_0Ptr.asFunction<
+      instancetype Function(ffi.Pointer<ObjCObject>, ffi.Pointer<ObjCSel>)>();
+
+  instancetype _objc_msgSend_1(
+    ffi.Pointer<ObjCObject> obj,
+    ffi.Pointer<ObjCSel> sel,
+    ffi.Pointer<_NSZone> zone,
+  ) {
+    return __objc_msgSend_1(
+      obj,
+      sel,
+      zone,
+    );
+  }
+
+  late final __objc_msgSend_1Ptr = _lookup<
+      ffi.NativeFunction<
+          instancetype Function(ffi.Pointer<ObjCObject>, ffi.Pointer<ObjCSel>,
+              ffi.Pointer<_NSZone>)>>('objc_msgSend');
+  late final __objc_msgSend_1 = __objc_msgSend_1Ptr.asFunction<
+      instancetype Function(ffi.Pointer<ObjCObject>, ffi.Pointer<ObjCSel>,
+          ffi.Pointer<_NSZone>)>();
+
+  ffi.Pointer<ObjCObject> _objc_msgSend_2(
+    ffi.Pointer<ObjCObject> obj,
+    ffi.Pointer<ObjCSel> sel,
+  ) {
+    return __objc_msgSend_2(
+      obj,
+      sel,
+    );
+  }
+
+  late final __objc_msgSend_2Ptr = _lookup<
+      ffi.NativeFunction<
+          ffi.Pointer<ObjCObject> Function(
+              ffi.Pointer<ObjCObject>, ffi.Pointer<ObjCSel>)>>('objc_msgSend');
+  late final __objc_msgSend_2 = __objc_msgSend_2Ptr.asFunction<
+      ffi.Pointer<ObjCObject> Function(
+          ffi.Pointer<ObjCObject>, ffi.Pointer<ObjCSel>)>();
+
+  ffi.Pointer<ObjCObject> _objc_msgSend_3(
+    ffi.Pointer<ObjCObject> obj,
+    ffi.Pointer<ObjCSel> sel,
+  ) {
+    return __objc_msgSend_3(
+      obj,
+      sel,
+    );
+  }
+
+  late final __objc_msgSend_3Ptr = _lookup<
+      ffi.NativeFunction<
+          ffi.Pointer<ObjCObject> Function(
+              ffi.Pointer<ObjCObject>, ffi.Pointer<ObjCSel>)>>('objc_msgSend');
+  late final __objc_msgSend_3 = __objc_msgSend_3Ptr.asFunction<
+      ffi.Pointer<ObjCObject> Function(
+          ffi.Pointer<ObjCObject>, ffi.Pointer<ObjCSel>)>();
+
+  ffi.Pointer<ObjCObject> _objc_msgSend_4(
+    ffi.Pointer<ObjCObject> obj,
+    ffi.Pointer<ObjCSel> sel,
+    ffi.Pointer<_NSZone> zone,
+  ) {
+    return __objc_msgSend_4(
+      obj,
+      sel,
+      zone,
+    );
+  }
+
+  late final __objc_msgSend_4Ptr = _lookup<
+      ffi.NativeFunction<
+          ffi.Pointer<ObjCObject> Function(ffi.Pointer<ObjCObject>,
+              ffi.Pointer<ObjCSel>, ffi.Pointer<_NSZone>)>>('objc_msgSend');
+  late final __objc_msgSend_4 = __objc_msgSend_4Ptr.asFunction<
+      ffi.Pointer<ObjCObject> Function(ffi.Pointer<ObjCObject>,
+          ffi.Pointer<ObjCSel>, ffi.Pointer<_NSZone>)>();
+
+  ffi.Pointer<ObjCObject> _objc_msgSend_5(
+    ffi.Pointer<ObjCObject> obj,
+    ffi.Pointer<ObjCSel> sel,
+    ffi.Pointer<_NSZone> zone,
+  ) {
+    return __objc_msgSend_5(
+      obj,
+      sel,
+      zone,
+    );
+  }
+
+  late final __objc_msgSend_5Ptr = _lookup<
+      ffi.NativeFunction<
+          ffi.Pointer<ObjCObject> Function(ffi.Pointer<ObjCObject>,
+              ffi.Pointer<ObjCSel>, ffi.Pointer<_NSZone>)>>('objc_msgSend');
+  late final __objc_msgSend_5 = __objc_msgSend_5Ptr.asFunction<
+      ffi.Pointer<ObjCObject> Function(ffi.Pointer<ObjCObject>,
+          ffi.Pointer<ObjCSel>, ffi.Pointer<_NSZone>)>();
+
+  int _objc_msgSend_6(
+    ffi.Pointer<ObjCObject> obj,
+    ffi.Pointer<ObjCSel> sel,
+    ffi.Pointer<ObjCSel> aSelector,
+  ) {
+    return __objc_msgSend_6(
+      obj,
+      sel,
+      aSelector,
+    );
+  }
+
+  late final __objc_msgSend_6Ptr = _lookup<
+      ffi.NativeFunction<
+          BOOL Function(ffi.Pointer<ObjCObject>, ffi.Pointer<ObjCSel>,
+              ffi.Pointer<ObjCSel>)>>('objc_msgSend');
+  late final __objc_msgSend_6 = __objc_msgSend_6Ptr.asFunction<
+      int Function(ffi.Pointer<ObjCObject>, ffi.Pointer<ObjCSel>,
+          ffi.Pointer<ObjCSel>)>();
+
+  int _objc_msgSend_7(
+    ffi.Pointer<ObjCObject> obj,
+    ffi.Pointer<ObjCSel> sel,
+    ffi.Pointer<ObjCObject> protocol,
+  ) {
+    return __objc_msgSend_7(
+      obj,
+      sel,
+      protocol,
+    );
+  }
+
+  late final __objc_msgSend_7Ptr = _lookup<
+      ffi.NativeFunction<
+          BOOL Function(ffi.Pointer<ObjCObject>, ffi.Pointer<ObjCSel>,
+              ffi.Pointer<ObjCObject>)>>('objc_msgSend');
+  late final __objc_msgSend_7 = __objc_msgSend_7Ptr.asFunction<
+      int Function(ffi.Pointer<ObjCObject>, ffi.Pointer<ObjCSel>,
+          ffi.Pointer<ObjCObject>)>();
+
+  IMP _objc_msgSend_8(
+    ffi.Pointer<ObjCObject> obj,
+    ffi.Pointer<ObjCSel> sel,
+    ffi.Pointer<ObjCSel> aSelector,
+  ) {
+    return __objc_msgSend_8(
+      obj,
+      sel,
+      aSelector,
+    );
+  }
+
+  late final __objc_msgSend_8Ptr = _lookup<
+      ffi.NativeFunction<
+          IMP Function(ffi.Pointer<ObjCObject>, ffi.Pointer<ObjCSel>,
+              ffi.Pointer<ObjCSel>)>>('objc_msgSend');
+  late final __objc_msgSend_8 = __objc_msgSend_8Ptr.asFunction<
+      IMP Function(ffi.Pointer<ObjCObject>, ffi.Pointer<ObjCSel>,
+          ffi.Pointer<ObjCSel>)>();
+
+  IMP _objc_msgSend_9(
+    ffi.Pointer<ObjCObject> obj,
+    ffi.Pointer<ObjCSel> sel,
+    ffi.Pointer<ObjCSel> aSelector,
+  ) {
+    return __objc_msgSend_9(
+      obj,
+      sel,
+      aSelector,
+    );
+  }
+
+  late final __objc_msgSend_9Ptr = _lookup<
+      ffi.NativeFunction<
+          IMP Function(ffi.Pointer<ObjCObject>, ffi.Pointer<ObjCSel>,
+              ffi.Pointer<ObjCSel>)>>('objc_msgSend');
+  late final __objc_msgSend_9 = __objc_msgSend_9Ptr.asFunction<
+      IMP Function(ffi.Pointer<ObjCObject>, ffi.Pointer<ObjCSel>,
+          ffi.Pointer<ObjCSel>)>();
+
+  ffi.Pointer<ObjCObject> _objc_msgSend_10(
+    ffi.Pointer<ObjCObject> obj,
+    ffi.Pointer<ObjCSel> sel,
+    ffi.Pointer<ObjCSel> aSelector,
+  ) {
+    return __objc_msgSend_10(
+      obj,
+      sel,
+      aSelector,
+    );
+  }
+
+  late final __objc_msgSend_10Ptr = _lookup<
+      ffi.NativeFunction<
+          ffi.Pointer<ObjCObject> Function(ffi.Pointer<ObjCObject>,
+              ffi.Pointer<ObjCSel>, ffi.Pointer<ObjCSel>)>>('objc_msgSend');
+  late final __objc_msgSend_10 = __objc_msgSend_10Ptr.asFunction<
+      ffi.Pointer<ObjCObject> Function(ffi.Pointer<ObjCObject>,
+          ffi.Pointer<ObjCSel>, ffi.Pointer<ObjCSel>)>();
+
+  ffi.Pointer<ObjCObject> _objc_msgSend_11(
+    ffi.Pointer<ObjCObject> obj,
+    ffi.Pointer<ObjCSel> sel,
+    ffi.Pointer<ObjCSel> aSelector,
+  ) {
+    return __objc_msgSend_11(
+      obj,
+      sel,
+      aSelector,
+    );
+  }
+
+  late final __objc_msgSend_11Ptr = _lookup<
+      ffi.NativeFunction<
+          ffi.Pointer<ObjCObject> Function(ffi.Pointer<ObjCObject>,
+              ffi.Pointer<ObjCSel>, ffi.Pointer<ObjCSel>)>>('objc_msgSend');
+  late final __objc_msgSend_11 = __objc_msgSend_11Ptr.asFunction<
+      ffi.Pointer<ObjCObject> Function(ffi.Pointer<ObjCObject>,
+          ffi.Pointer<ObjCSel>, ffi.Pointer<ObjCSel>)>();
+
+  ffi.Pointer<ObjCObject> _objc_msgSend_12(
+    ffi.Pointer<ObjCObject> obj,
+    ffi.Pointer<ObjCSel> sel,
+    ffi.Pointer<ObjCSel> aSelector,
+  ) {
+    return __objc_msgSend_12(
+      obj,
+      sel,
+      aSelector,
+    );
+  }
+
+  late final __objc_msgSend_12Ptr = _lookup<
+      ffi.NativeFunction<
+          ffi.Pointer<ObjCObject> Function(ffi.Pointer<ObjCObject>,
+              ffi.Pointer<ObjCSel>, ffi.Pointer<ObjCSel>)>>('objc_msgSend');
+  late final __objc_msgSend_12 = __objc_msgSend_12Ptr.asFunction<
+      ffi.Pointer<ObjCObject> Function(ffi.Pointer<ObjCObject>,
+          ffi.Pointer<ObjCSel>, ffi.Pointer<ObjCSel>)>();
+
+  int _objc_msgSend_13(
+    ffi.Pointer<ObjCObject> obj,
+    ffi.Pointer<ObjCSel> sel,
+  ) {
+    return __objc_msgSend_13(
+      obj,
+      sel,
+    );
+  }
+
+  late final __objc_msgSend_13Ptr = _lookup<
+      ffi.NativeFunction<
+          BOOL Function(
+              ffi.Pointer<ObjCObject>, ffi.Pointer<ObjCSel>)>>('objc_msgSend');
+  late final __objc_msgSend_13 = __objc_msgSend_13Ptr.asFunction<
+      int Function(ffi.Pointer<ObjCObject>, ffi.Pointer<ObjCSel>)>();
+
+  int _objc_msgSend_14(
+    ffi.Pointer<ObjCObject> obj,
+    ffi.Pointer<ObjCSel> sel,
+    ffi.Pointer<ObjCObject> aClass,
+  ) {
+    return __objc_msgSend_14(
+      obj,
+      sel,
+      aClass,
+    );
+  }
+
+  late final __objc_msgSend_14Ptr = _lookup<
+      ffi.NativeFunction<
+          BOOL Function(ffi.Pointer<ObjCObject>, ffi.Pointer<ObjCSel>,
+              ffi.Pointer<ObjCObject>)>>('objc_msgSend');
+  late final __objc_msgSend_14 = __objc_msgSend_14Ptr.asFunction<
+      int Function(ffi.Pointer<ObjCObject>, ffi.Pointer<ObjCSel>,
+          ffi.Pointer<ObjCObject>)>();
+
+  int _objc_msgSend_15(
+    ffi.Pointer<ObjCObject> obj,
+    ffi.Pointer<ObjCSel> sel,
+    ffi.Pointer<ObjCSel> sel1,
+  ) {
+    return __objc_msgSend_15(
+      obj,
+      sel,
+      sel1,
+    );
+  }
+
+  late final __objc_msgSend_15Ptr = _lookup<
+      ffi.NativeFunction<
+          BOOL Function(ffi.Pointer<ObjCObject>, ffi.Pointer<ObjCSel>,
+              ffi.Pointer<ObjCSel>)>>('objc_msgSend');
+  late final __objc_msgSend_15 = __objc_msgSend_15Ptr.asFunction<
+      int Function(ffi.Pointer<ObjCObject>, ffi.Pointer<ObjCSel>,
+          ffi.Pointer<ObjCSel>)>();
+
+  int _objc_msgSend_16(
+    ffi.Pointer<ObjCObject> obj,
+    ffi.Pointer<ObjCSel> sel,
+    ffi.Pointer<ObjCSel> sel1,
+  ) {
+    return __objc_msgSend_16(
+      obj,
+      sel,
+      sel1,
+    );
+  }
+
+  late final __objc_msgSend_16Ptr = _lookup<
+      ffi.NativeFunction<
+          BOOL Function(ffi.Pointer<ObjCObject>, ffi.Pointer<ObjCSel>,
+              ffi.Pointer<ObjCSel>)>>('objc_msgSend');
+  late final __objc_msgSend_16 = __objc_msgSend_16Ptr.asFunction<
+      int Function(ffi.Pointer<ObjCObject>, ffi.Pointer<ObjCSel>,
+          ffi.Pointer<ObjCSel>)>();
+
+  int _objc_msgSend_17(
+    ffi.Pointer<ObjCObject> obj,
+    ffi.Pointer<ObjCSel> sel,
+  ) {
+    return __objc_msgSend_17(
+      obj,
+      sel,
+    );
+  }
+
+  late final __objc_msgSend_17Ptr = _lookup<
+      ffi.NativeFunction<
+          NSUInteger Function(
+              ffi.Pointer<ObjCObject>, ffi.Pointer<ObjCSel>)>>('objc_msgSend');
+  late final __objc_msgSend_17 = __objc_msgSend_17Ptr.asFunction<
+      int Function(ffi.Pointer<ObjCObject>, ffi.Pointer<ObjCSel>)>();
+
+  ffi.Pointer<ObjCObject> _objc_msgSend_18(
+    ffi.Pointer<ObjCObject> obj,
+    ffi.Pointer<ObjCSel> sel,
+  ) {
+    return __objc_msgSend_18(
+      obj,
+      sel,
+    );
+  }
+
+  late final __objc_msgSend_18Ptr = _lookup<
+      ffi.NativeFunction<
+          ffi.Pointer<ObjCObject> Function(
+              ffi.Pointer<ObjCObject>, ffi.Pointer<ObjCSel>)>>('objc_msgSend');
+  late final __objc_msgSend_18 = __objc_msgSend_18Ptr.asFunction<
+      ffi.Pointer<ObjCObject> Function(
+          ffi.Pointer<ObjCObject>, ffi.Pointer<ObjCSel>)>();
+
+  ffi.Pointer<ObjCObject> _objc_msgSend_19(
+    ffi.Pointer<ObjCObject> obj,
+    ffi.Pointer<ObjCSel> sel,
+  ) {
+    return __objc_msgSend_19(
+      obj,
+      sel,
+    );
+  }
+
+  late final __objc_msgSend_19Ptr = _lookup<
+      ffi.NativeFunction<
+          ffi.Pointer<ObjCObject> Function(
+              ffi.Pointer<ObjCObject>, ffi.Pointer<ObjCSel>)>>('objc_msgSend');
+  late final __objc_msgSend_19 = __objc_msgSend_19Ptr.asFunction<
+      ffi.Pointer<ObjCObject> Function(
+          ffi.Pointer<ObjCObject>, ffi.Pointer<ObjCSel>)>();
+
+  ffi.Pointer<ObjCObject> _objc_msgSend_20(
+    ffi.Pointer<ObjCObject> obj,
+    ffi.Pointer<ObjCSel> sel,
+  ) {
+    return __objc_msgSend_20(
+      obj,
+      sel,
+    );
+  }
+
+  late final __objc_msgSend_20Ptr = _lookup<
+      ffi.NativeFunction<
+          ffi.Pointer<ObjCObject> Function(
+              ffi.Pointer<ObjCObject>, ffi.Pointer<ObjCSel>)>>('objc_msgSend');
+  late final __objc_msgSend_20 = __objc_msgSend_20Ptr.asFunction<
+      ffi.Pointer<ObjCObject> Function(
+          ffi.Pointer<ObjCObject>, ffi.Pointer<ObjCSel>)>();
+
+  int _objc_msgSend_21(
+    ffi.Pointer<ObjCObject> obj,
+    ffi.Pointer<ObjCSel> sel,
+  ) {
+    return __objc_msgSend_21(
+      obj,
+      sel,
+    );
+  }
+
+  late final __objc_msgSend_21Ptr = _lookup<
+      ffi.NativeFunction<
+          ffi.Int32 Function(
+              ffi.Pointer<ObjCObject>, ffi.Pointer<ObjCSel>)>>('objc_msgSend');
+  late final __objc_msgSend_21 = __objc_msgSend_21Ptr.asFunction<
+      int Function(ffi.Pointer<ObjCObject>, ffi.Pointer<ObjCSel>)>();
+
+  void _objc_msgSend_22(
+    ffi.Pointer<ObjCObject> obj,
+    ffi.Pointer<ObjCSel> sel,
+    int value,
+  ) {
+    return __objc_msgSend_22(
+      obj,
+      sel,
+      value,
+    );
+  }
+
+  late final __objc_msgSend_22Ptr = _lookup<
+      ffi.NativeFunction<
+          ffi.Void Function(ffi.Pointer<ObjCObject>, ffi.Pointer<ObjCSel>,
+              ffi.Int32)>>('objc_msgSend');
+  late final __objc_msgSend_22 = __objc_msgSend_22Ptr.asFunction<
+      void Function(ffi.Pointer<ObjCObject>, ffi.Pointer<ObjCSel>, int)>();
+
+  ffi.Pointer<ObjCObject> _objc_msgSend_23(
+    ffi.Pointer<ObjCObject> obj,
+    ffi.Pointer<ObjCSel> sel,
+    double x,
+  ) {
+    return __objc_msgSend_23(
+      obj,
+      sel,
+      x,
+    );
+  }
+
+  late final __objc_msgSend_23Ptr = _lookup<
+      ffi.NativeFunction<
+          ffi.Pointer<ObjCObject> Function(ffi.Pointer<ObjCObject>,
+              ffi.Pointer<ObjCSel>, ffi.Double)>>('objc_msgSend');
+  late final __objc_msgSend_23 = __objc_msgSend_23Ptr.asFunction<
+      ffi.Pointer<ObjCObject> Function(
+          ffi.Pointer<ObjCObject>, ffi.Pointer<ObjCSel>, double)>();
+
+  int _objc_msgSend_24(
+    ffi.Pointer<ObjCObject> obj,
+    ffi.Pointer<ObjCSel> sel,
+    int useIntVals,
+    ffi.Pointer<ObjCObject> other,
+  ) {
+    return __objc_msgSend_24(
+      obj,
+      sel,
+      useIntVals,
+      other,
+    );
+  }
+
+  late final __objc_msgSend_24Ptr = _lookup<
+      ffi.NativeFunction<
+          ffi.Int32 Function(ffi.Pointer<ObjCObject>, ffi.Pointer<ObjCSel>,
+              BOOL, ffi.Pointer<ObjCObject>)>>('objc_msgSend');
+  late final __objc_msgSend_24 = __objc_msgSend_24Ptr.asFunction<
+      int Function(ffi.Pointer<ObjCObject>, ffi.Pointer<ObjCSel>, int,
+          ffi.Pointer<ObjCObject>)>();
+}
+
+class ObjCObject extends ffi.Opaque {}
+
+class ObjCSel extends ffi.Opaque {}
+
+typedef NSUInteger = pkg_ffi.UnsignedLong;
+
+class __va_list_tag extends ffi.Struct {
+  @pkg_ffi.UnsignedInt()
+  external int gp_offset;
+
+  @pkg_ffi.UnsignedInt()
+  external int fp_offset;
+
+  external ffi.Pointer<ffi.Void> overflow_arg_area;
+
+  external ffi.Pointer<ffi.Void> reg_save_area;
+}
+
+abstract class NSComparisonResult {
+  static const int NSOrderedAscending = -1;
+  static const int NSOrderedSame = 0;
+  static const int NSOrderedDescending = 1;
+}
+
+abstract class NSEnumerationOptions {
+  static const int NSEnumerationConcurrent = 1;
+  static const int NSEnumerationReverse = 2;
+}
+
+abstract class NSSortOptions {
+  static const int NSSortConcurrent = 1;
+  static const int NSSortStable = 16;
+}
+
+abstract class NSQualityOfService {
+  static const int NSQualityOfServiceUserInteractive = 33;
+  static const int NSQualityOfServiceUserInitiated = 25;
+  static const int NSQualityOfServiceUtility = 17;
+  static const int NSQualityOfServiceBackground = 9;
+  static const int NSQualityOfServiceDefault = -1;
+}
+
+typedef NSInteger = pkg_ffi.Long;
+
+class __CFString extends ffi.Opaque {}
+
+abstract class CFComparisonResult {
+  static const int kCFCompareLessThan = -1;
+  static const int kCFCompareEqualTo = 0;
+  static const int kCFCompareGreaterThan = 1;
+}
+
+typedef CFIndex = pkg_ffi.Long;
+
+class CFRange extends ffi.Struct {
+  @CFIndex()
+  external int location;
+
+  @CFIndex()
+  external int length;
+}
+
+class __CFNull extends ffi.Opaque {}
+
+typedef CFTypeID = pkg_ffi.UnsignedLong;
+typedef CFNullRef = ffi.Pointer<__CFNull>;
+
+class __CFAllocator extends ffi.Opaque {}
+
+typedef CFAllocatorRef = ffi.Pointer<__CFAllocator>;
+
+class CFAllocatorContext extends ffi.Struct {
+  @CFIndex()
+  external int version;
+
+  external ffi.Pointer<ffi.Void> info;
+
+  external CFAllocatorRetainCallBack retain;
+
+  external CFAllocatorReleaseCallBack release;
+
+  external CFAllocatorCopyDescriptionCallBack copyDescription;
+
+  external CFAllocatorAllocateCallBack allocate;
+
+  external CFAllocatorReallocateCallBack reallocate;
+
+  external CFAllocatorDeallocateCallBack deallocate;
+
+  external CFAllocatorPreferredSizeCallBack preferredSize;
+}
+
+typedef CFAllocatorRetainCallBack = ffi.Pointer<
+    ffi.NativeFunction<ffi.Pointer<ffi.Void> Function(ffi.Pointer<ffi.Void>)>>;
+typedef CFAllocatorReleaseCallBack
+    = ffi.Pointer<ffi.NativeFunction<ffi.Void Function(ffi.Pointer<ffi.Void>)>>;
+typedef CFAllocatorCopyDescriptionCallBack = ffi
+    .Pointer<ffi.NativeFunction<CFStringRef Function(ffi.Pointer<ffi.Void>)>>;
+typedef CFStringRef = ffi.Pointer<__CFString>;
+typedef CFAllocatorAllocateCallBack = ffi.Pointer<
+    ffi.NativeFunction<
+        ffi.Pointer<ffi.Void> Function(
+            CFIndex, CFOptionFlags, ffi.Pointer<ffi.Void>)>>;
+typedef CFOptionFlags = pkg_ffi.UnsignedLong;
+typedef CFAllocatorReallocateCallBack = ffi.Pointer<
+    ffi.NativeFunction<
+        ffi.Pointer<ffi.Void> Function(ffi.Pointer<ffi.Void>, CFIndex,
+            CFOptionFlags, ffi.Pointer<ffi.Void>)>>;
+typedef CFAllocatorDeallocateCallBack = ffi.Pointer<
+    ffi.NativeFunction<
+        ffi.Void Function(ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>>;
+typedef CFAllocatorPreferredSizeCallBack = ffi.Pointer<
+    ffi.NativeFunction<
+        CFIndex Function(CFIndex, CFOptionFlags, ffi.Pointer<ffi.Void>)>>;
+typedef CFTypeRef = ffi.Pointer<ffi.Void>;
+typedef Boolean = pkg_ffi.UnsignedChar;
+typedef CFHashCode = pkg_ffi.UnsignedLong;
+typedef NSZone = _NSZone;
+
+class _NSZone extends ffi.Opaque {}
+
+typedef BOOL = pkg_ffi.SignedChar;
+
+ffi.Pointer<ObjCSel> _registerName(NativeObjCLibrary _lib, String name) {
+  final cstr = name.toNativeUtf8();
+  final sel = _lib._sel_registerName(cstr.cast());
+  pkg_ffi.calloc.free(cstr);
+  return sel;
+}
+
+ffi.Pointer<ObjCObject> _getClass(NativeObjCLibrary _lib, String name) {
+  final cstr = name.toNativeUtf8();
+  final clazz = _lib._objc_getClass(cstr.cast());
+  pkg_ffi.calloc.free(cstr);
+  return clazz;
+}
+
+class _ObjCWrapper {
+  final ffi.Pointer<ObjCObject> _id;
+  final NativeObjCLibrary _lib;
+  _ObjCWrapper._(this._id, this._lib);
+}
+
+class Foo extends NSObject {
+  Foo._(ffi.Pointer<ObjCObject> id, NativeObjCLibrary lib) : super._(id, lib);
+
+  static ffi.Pointer<ObjCObject>? _class;
+
+  static Foo castFrom<T extends _ObjCWrapper>(T other) {
+    return Foo._(other._id, other._lib);
+  }
+
+  static ffi.Pointer<ObjCSel>? _sel_intVal;
+  int get intVal {
+    _sel_intVal ??= _registerName(_lib, "intVal");
+    return _lib._objc_msgSend_21(_id, _sel_intVal!);
+  }
+
+  static ffi.Pointer<ObjCSel>? _sel_intVal1;
+  set intVal(int value) {
+    _sel_intVal1 ??= _registerName(_lib, "setIntVal:");
+    return _lib._objc_msgSend_22(_id, _sel_intVal1!, value);
+  }
+
+  static ffi.Pointer<ObjCSel>? _sel_makeFoo;
+  static Foo makeFoo(NativeObjCLibrary _lib, double x) {
+    _class ??= _getClass(_lib, "Foo");
+    _sel_makeFoo ??= _registerName(_lib, "makeFoo:");
+    final _ret = _lib._objc_msgSend_23(_class!, _sel_makeFoo!, x);
+    return Foo._(_ret, _lib);
+  }
+
+  static ffi.Pointer<ObjCSel>? _sel_multiply;
+  int multiply(int useIntVals, NSObject other) {
+    _sel_multiply ??= _registerName(_lib, "multiply:withOtherFoo:");
+    return _lib._objc_msgSend_24(_id, _sel_multiply!, useIntVals, other._id);
+  }
+
+  static ffi.Pointer<ObjCSel>? _sel_new1;
+  static Foo new1(NativeObjCLibrary _lib) {
+    _class ??= _getClass(_lib, "Foo");
+    _sel_new1 ??= _registerName(_lib, "new");
+    final _ret = _lib._objc_msgSend_0(_class!, _sel_new1!);
+    return Foo._(_ret, _lib);
+  }
+
+  static ffi.Pointer<ObjCSel>? _sel_alloc;
+  static Foo alloc(NativeObjCLibrary _lib) {
+    _class ??= _getClass(_lib, "Foo");
+    _sel_alloc ??= _registerName(_lib, "alloc");
+    final _ret = _lib._objc_msgSend_0(_class!, _sel_alloc!);
+    return Foo._(_ret, _lib);
+  }
+}
+
+class NSObject extends _ObjCWrapper {
+  NSObject._(ffi.Pointer<ObjCObject> id, NativeObjCLibrary lib)
+      : super._(id, lib);
+
+  static ffi.Pointer<ObjCObject>? _class;
+
+  static NSObject castFrom<T extends _ObjCWrapper>(T other) {
+    return NSObject._(other._id, other._lib);
+  }
+
+  static ffi.Pointer<ObjCSel>? _sel_init;
+  NSObject init() {
+    _sel_init ??= _registerName(_lib, "init");
+    final _ret = _lib._objc_msgSend_0(_id, _sel_init!);
+    return NSObject._(_ret, _lib);
+  }
+
+  static ffi.Pointer<ObjCSel>? _sel_new1;
+  static NSObject new1(NativeObjCLibrary _lib) {
+    _class ??= _getClass(_lib, "NSObject");
+    _sel_new1 ??= _registerName(_lib, "new");
+    final _ret = _lib._objc_msgSend_0(_class!, _sel_new1!);
+    return NSObject._(_ret, _lib);
+  }
+
+  static ffi.Pointer<ObjCSel>? _sel_allocWithZone;
+  static NSObject allocWithZone(
+      NativeObjCLibrary _lib, ffi.Pointer<_NSZone> zone) {
+    _class ??= _getClass(_lib, "NSObject");
+    _sel_allocWithZone ??= _registerName(_lib, "allocWithZone:");
+    final _ret = _lib._objc_msgSend_1(_class!, _sel_allocWithZone!, zone);
+    return NSObject._(_ret, _lib);
+  }
+
+  static ffi.Pointer<ObjCSel>? _sel_alloc;
+  static NSObject alloc(NativeObjCLibrary _lib) {
+    _class ??= _getClass(_lib, "NSObject");
+    _sel_alloc ??= _registerName(_lib, "alloc");
+    final _ret = _lib._objc_msgSend_0(_class!, _sel_alloc!);
+    return NSObject._(_ret, _lib);
+  }
+
+  static ffi.Pointer<ObjCSel>? _sel_copy;
+  NSObject copy() {
+    _sel_copy ??= _registerName(_lib, "copy");
+    final _ret = _lib._objc_msgSend_2(_id, _sel_copy!);
+    return NSObject._(_ret, _lib);
+  }
+
+  static ffi.Pointer<ObjCSel>? _sel_mutableCopy;
+  NSObject mutableCopy() {
+    _sel_mutableCopy ??= _registerName(_lib, "mutableCopy");
+    final _ret = _lib._objc_msgSend_3(_id, _sel_mutableCopy!);
+    return NSObject._(_ret, _lib);
+  }
+
+  static ffi.Pointer<ObjCSel>? _sel_copyWithZone;
+  static NSObject copyWithZone(
+      NativeObjCLibrary _lib, ffi.Pointer<_NSZone> zone) {
+    _class ??= _getClass(_lib, "NSObject");
+    _sel_copyWithZone ??= _registerName(_lib, "copyWithZone:");
+    final _ret = _lib._objc_msgSend_4(_class!, _sel_copyWithZone!, zone);
+    return NSObject._(_ret, _lib);
+  }
+
+  static ffi.Pointer<ObjCSel>? _sel_mutableCopyWithZone;
+  static NSObject mutableCopyWithZone(
+      NativeObjCLibrary _lib, ffi.Pointer<_NSZone> zone) {
+    _class ??= _getClass(_lib, "NSObject");
+    _sel_mutableCopyWithZone ??= _registerName(_lib, "mutableCopyWithZone:");
+    final _ret = _lib._objc_msgSend_5(_class!, _sel_mutableCopyWithZone!, zone);
+    return NSObject._(_ret, _lib);
+  }
+
+  static ffi.Pointer<ObjCSel>? _sel_instancesRespondToSelector;
+  static int instancesRespondToSelector(
+      NativeObjCLibrary _lib, ffi.Pointer<ObjCSel> aSelector) {
+    _class ??= _getClass(_lib, "NSObject");
+    _sel_instancesRespondToSelector ??=
+        _registerName(_lib, "instancesRespondToSelector:");
+    return _lib._objc_msgSend_6(
+        _class!, _sel_instancesRespondToSelector!, aSelector);
+  }
+
+  static ffi.Pointer<ObjCSel>? _sel_conformsToProtocol;
+  static int conformsToProtocol(NativeObjCLibrary _lib, NSObject protocol) {
+    _class ??= _getClass(_lib, "NSObject");
+    _sel_conformsToProtocol ??= _registerName(_lib, "conformsToProtocol:");
+    return _lib._objc_msgSend_7(
+        _class!, _sel_conformsToProtocol!, protocol._id);
+  }
+
+  static ffi.Pointer<ObjCSel>? _sel_methodForSelector;
+  IMP methodForSelector(ffi.Pointer<ObjCSel> aSelector) {
+    _sel_methodForSelector ??= _registerName(_lib, "methodForSelector:");
+    return _lib._objc_msgSend_8(_id, _sel_methodForSelector!, aSelector);
+  }
+
+  static ffi.Pointer<ObjCSel>? _sel_instanceMethodForSelector;
+  static IMP instanceMethodForSelector(
+      NativeObjCLibrary _lib, ffi.Pointer<ObjCSel> aSelector) {
+    _class ??= _getClass(_lib, "NSObject");
+    _sel_instanceMethodForSelector ??=
+        _registerName(_lib, "instanceMethodForSelector:");
+    return _lib._objc_msgSend_9(
+        _class!, _sel_instanceMethodForSelector!, aSelector);
+  }
+
+  static ffi.Pointer<ObjCSel>? _sel_forwardingTargetForSelector;
+  NSObject forwardingTargetForSelector(ffi.Pointer<ObjCSel> aSelector) {
+    _sel_forwardingTargetForSelector ??=
+        _registerName(_lib, "forwardingTargetForSelector:");
+    final _ret = _lib._objc_msgSend_10(
+        _id, _sel_forwardingTargetForSelector!, aSelector);
+    return NSObject._(_ret, _lib);
+  }
+
+  static ffi.Pointer<ObjCSel>? _sel_methodSignatureForSelector;
+  NSMethodSignature methodSignatureForSelector(ffi.Pointer<ObjCSel> aSelector) {
+    _sel_methodSignatureForSelector ??=
+        _registerName(_lib, "methodSignatureForSelector:");
+    final _ret =
+        _lib._objc_msgSend_11(_id, _sel_methodSignatureForSelector!, aSelector);
+    return NSMethodSignature._(_ret, _lib);
+  }
+
+  static ffi.Pointer<ObjCSel>? _sel_instanceMethodSignatureForSelector;
+  static NSMethodSignature instanceMethodSignatureForSelector(
+      NativeObjCLibrary _lib, ffi.Pointer<ObjCSel> aSelector) {
+    _class ??= _getClass(_lib, "NSObject");
+    _sel_instanceMethodSignatureForSelector ??=
+        _registerName(_lib, "instanceMethodSignatureForSelector:");
+    final _ret = _lib._objc_msgSend_12(
+        _class!, _sel_instanceMethodSignatureForSelector!, aSelector);
+    return NSMethodSignature._(_ret, _lib);
+  }
+
+  static ffi.Pointer<ObjCSel>? _sel_allowsWeakReference;
+  int allowsWeakReference() {
+    _sel_allowsWeakReference ??= _registerName(_lib, "allowsWeakReference");
+    return _lib._objc_msgSend_13(_id, _sel_allowsWeakReference!);
+  }
+
+  static ffi.Pointer<ObjCSel>? _sel_retainWeakReference;
+  int retainWeakReference() {
+    _sel_retainWeakReference ??= _registerName(_lib, "retainWeakReference");
+    return _lib._objc_msgSend_13(_id, _sel_retainWeakReference!);
+  }
+
+  static ffi.Pointer<ObjCSel>? _sel_isSubclassOfClass;
+  static int isSubclassOfClass(NativeObjCLibrary _lib, NSObject aClass) {
+    _class ??= _getClass(_lib, "NSObject");
+    _sel_isSubclassOfClass ??= _registerName(_lib, "isSubclassOfClass:");
+    return _lib._objc_msgSend_14(_class!, _sel_isSubclassOfClass!, aClass._id);
+  }
+
+  static ffi.Pointer<ObjCSel>? _sel_resolveClassMethod;
+  static int resolveClassMethod(
+      NativeObjCLibrary _lib, ffi.Pointer<ObjCSel> sel) {
+    _class ??= _getClass(_lib, "NSObject");
+    _sel_resolveClassMethod ??= _registerName(_lib, "resolveClassMethod:");
+    return _lib._objc_msgSend_15(_class!, _sel_resolveClassMethod!, sel);
+  }
+
+  static ffi.Pointer<ObjCSel>? _sel_resolveInstanceMethod;
+  static int resolveInstanceMethod(
+      NativeObjCLibrary _lib, ffi.Pointer<ObjCSel> sel) {
+    _class ??= _getClass(_lib, "NSObject");
+    _sel_resolveInstanceMethod ??=
+        _registerName(_lib, "resolveInstanceMethod:");
+    return _lib._objc_msgSend_16(_class!, _sel_resolveInstanceMethod!, sel);
+  }
+
+  static ffi.Pointer<ObjCSel>? _sel_hash;
+  static int hash(NativeObjCLibrary _lib) {
+    _class ??= _getClass(_lib, "NSObject");
+    _sel_hash ??= _registerName(_lib, "hash");
+    return _lib._objc_msgSend_17(_class!, _sel_hash!);
+  }
+
+  static ffi.Pointer<ObjCSel>? _sel_superclass;
+  static NSObject superclass(NativeObjCLibrary _lib) {
+    _class ??= _getClass(_lib, "NSObject");
+    _sel_superclass ??= _registerName(_lib, "superclass");
+    final _ret = _lib._objc_msgSend_18(_class!, _sel_superclass!);
+    return NSObject._(_ret, _lib);
+  }
+
+  static ffi.Pointer<ObjCSel>? _sel_class1;
+  static NSObject class1(NativeObjCLibrary _lib) {
+    _class ??= _getClass(_lib, "NSObject");
+    _sel_class1 ??= _registerName(_lib, "class");
+    final _ret = _lib._objc_msgSend_19(_class!, _sel_class1!);
+    return NSObject._(_ret, _lib);
+  }
+
+  static ffi.Pointer<ObjCSel>? _sel_description;
+  static NSString description(NativeObjCLibrary _lib) {
+    _class ??= _getClass(_lib, "NSObject");
+    _sel_description ??= _registerName(_lib, "description");
+    final _ret = _lib._objc_msgSend_20(_class!, _sel_description!);
+    return NSString._(_ret, _lib);
+  }
+
+  static ffi.Pointer<ObjCSel>? _sel_debugDescription;
+  static NSString debugDescription(NativeObjCLibrary _lib) {
+    _class ??= _getClass(_lib, "NSObject");
+    _sel_debugDescription ??= _registerName(_lib, "debugDescription");
+    final _ret = _lib._objc_msgSend_20(_class!, _sel_debugDescription!);
+    return NSString._(_ret, _lib);
+  }
+}
+
+typedef instancetype = ffi.Pointer<ObjCObject>;
+typedef IMP = ffi.Pointer<ffi.NativeFunction<ffi.Void Function()>>;
+
+class NSMethodSignature extends _ObjCWrapper {
+  NSMethodSignature._(ffi.Pointer<ObjCObject> id, NativeObjCLibrary lib)
+      : super._(id, lib);
+
+  static ffi.Pointer<ObjCObject>? _class;
+
+  static NSMethodSignature castFrom<T extends _ObjCWrapper>(T other) {
+    return NSMethodSignature._(other._id, other._lib);
+  }
+}
+
+class NSString extends _ObjCWrapper {
+  NSString._(ffi.Pointer<ObjCObject> id, NativeObjCLibrary lib)
+      : super._(id, lib);
+
+  static ffi.Pointer<ObjCObject>? _class;
+
+  static NSString castFrom<T extends _ObjCWrapper>(T other) {
+    return NSString._(other._id, other._lib);
+  }
+}
+
+const int NSScannedOption = 1;
+
+const int NSCollectorDisabledOption = 2;
+
+const int NS_BLOCKS_AVAILABLE = 1;
+
+const int __COREFOUNDATION_CFAVAILABILITY__ = 1;
+
+const int __CF_ENUM_FIXED_IS_AVAILABLE = 1;
+
+const double NSFoundationVersionNumber10_0 = 397.4;
+
+const double NSFoundationVersionNumber10_1 = 425.0;
+
+const double NSFoundationVersionNumber10_1_1 = 425.0;
+
+const double NSFoundationVersionNumber10_1_2 = 425.0;
+
+const double NSFoundationVersionNumber10_1_3 = 425.0;
+
+const double NSFoundationVersionNumber10_1_4 = 425.0;
+
+const double NSFoundationVersionNumber10_2 = 462.0;
+
+const double NSFoundationVersionNumber10_2_1 = 462.0;
+
+const double NSFoundationVersionNumber10_2_2 = 462.0;
+
+const double NSFoundationVersionNumber10_2_3 = 462.0;
+
+const double NSFoundationVersionNumber10_2_4 = 462.0;
+
+const double NSFoundationVersionNumber10_2_5 = 462.0;
+
+const double NSFoundationVersionNumber10_2_6 = 462.0;
+
+const double NSFoundationVersionNumber10_2_7 = 462.7;
+
+const double NSFoundationVersionNumber10_2_8 = 462.7;
+
+const double NSFoundationVersionNumber10_3 = 500.0;
+
+const double NSFoundationVersionNumber10_3_1 = 500.0;
+
+const double NSFoundationVersionNumber10_3_2 = 500.3;
+
+const double NSFoundationVersionNumber10_3_3 = 500.54;
+
+const double NSFoundationVersionNumber10_3_4 = 500.56;
+
+const double NSFoundationVersionNumber10_3_5 = 500.56;
+
+const double NSFoundationVersionNumber10_3_6 = 500.56;
+
+const double NSFoundationVersionNumber10_3_7 = 500.56;
+
+const double NSFoundationVersionNumber10_3_8 = 500.56;
+
+const double NSFoundationVersionNumber10_3_9 = 500.58;
+
+const double NSFoundationVersionNumber10_4 = 567.0;
+
+const double NSFoundationVersionNumber10_4_1 = 567.0;
+
+const double NSFoundationVersionNumber10_4_2 = 567.12;
+
+const double NSFoundationVersionNumber10_4_3 = 567.21;
+
+const double NSFoundationVersionNumber10_4_4_Intel = 567.23;
+
+const double NSFoundationVersionNumber10_4_4_PowerPC = 567.21;
+
+const double NSFoundationVersionNumber10_4_5 = 567.25;
+
+const double NSFoundationVersionNumber10_4_6 = 567.26;
+
+const double NSFoundationVersionNumber10_4_7 = 567.27;
+
+const double NSFoundationVersionNumber10_4_8 = 567.28;
+
+const double NSFoundationVersionNumber10_4_9 = 567.29;
+
+const double NSFoundationVersionNumber10_4_10 = 567.29;
+
+const double NSFoundationVersionNumber10_4_11 = 567.36;
+
+const double NSFoundationVersionNumber10_5 = 677.0;
+
+const double NSFoundationVersionNumber10_5_1 = 677.1;
+
+const double NSFoundationVersionNumber10_5_2 = 677.15;
+
+const double NSFoundationVersionNumber10_5_3 = 677.19;
+
+const double NSFoundationVersionNumber10_5_4 = 677.19;
+
+const double NSFoundationVersionNumber10_5_5 = 677.21;
+
+const double NSFoundationVersionNumber10_5_6 = 677.22;
+
+const double NSFoundationVersionNumber10_5_7 = 677.24;
+
+const double NSFoundationVersionNumber10_5_8 = 677.26;
+
+const double NSFoundationVersionNumber10_6 = 751.0;
+
+const double NSFoundationVersionNumber10_6_1 = 751.0;
+
+const double NSFoundationVersionNumber10_6_2 = 751.14;
+
+const double NSFoundationVersionNumber10_6_3 = 751.21;
+
+const double NSFoundationVersionNumber10_6_4 = 751.29;
+
+const double NSFoundationVersionNumber10_6_5 = 751.42;
+
+const double NSFoundationVersionNumber10_6_6 = 751.53;
+
+const double NSFoundationVersionNumber10_6_7 = 751.53;
+
+const double NSFoundationVersionNumber10_6_8 = 751.62;
+
+const double NSFoundationVersionNumber10_7 = 833.1;
+
+const double NSFoundationVersionNumber10_7_1 = 833.1;
+
+const double NSFoundationVersionNumber10_7_2 = 833.2;
+
+const double NSFoundationVersionNumber10_7_3 = 833.24;
+
+const double NSFoundationVersionNumber10_7_4 = 833.25;
+
+const double NSFoundationVersionNumber10_8 = 945.0;
+
+const double NSFoundationVersionNumber10_8_1 = 945.0;
+
+const double NSFoundationVersionNumber10_8_2 = 945.11;
+
+const double NSFoundationVersionNumber10_8_3 = 945.16;
+
+const double NSFoundationVersionNumber10_8_4 = 945.18;
+
+const int NSFoundationVersionNumber10_9 = 1056;
+
+const int NSFoundationVersionNumber10_9_1 = 1056;
+
+const double NSFoundationVersionNumber10_9_2 = 1056.13;
+
+const double NSFoundationVersionNumber10_10 = 1151.16;
+
+const double NSFoundationVersionNumber10_10_1 = 1151.16;
+
+const double NSFoundationVersionNumber10_10_2 = 1152.14;
+
+const double NSFoundationVersionNumber10_10_3 = 1153.2;
+
+const double NSFoundationVersionNumber10_10_4 = 1153.2;
+
+const int NSFoundationVersionNumber10_10_5 = 1154;
+
+const int NSFoundationVersionNumber10_10_Max = 1199;
+
+const int NSFoundationVersionNumber10_11 = 1252;
+
+const double NSFoundationVersionNumber10_11_1 = 1255.1;
+
+const double NSFoundationVersionNumber10_11_2 = 1256.1;
+
+const double NSFoundationVersionNumber10_11_3 = 1256.1;
+
+const int NSFoundationVersionNumber10_11_4 = 1258;
+
+const int NSFoundationVersionNumber10_11_Max = 1299;
+
+const int __COREFOUNDATION_CFBASE__ = 1;
+
+const int TRUE = 1;
+
+const int FALSE = 0;
+
+const double kCFCoreFoundationVersionNumber10_0 = 196.4;
+
+const double kCFCoreFoundationVersionNumber10_0_3 = 196.5;
+
+const double kCFCoreFoundationVersionNumber10_1 = 226.0;
+
+const double kCFCoreFoundationVersionNumber10_1_1 = 226.0;
+
+const double kCFCoreFoundationVersionNumber10_1_2 = 227.2;
+
+const double kCFCoreFoundationVersionNumber10_1_3 = 227.2;
+
+const double kCFCoreFoundationVersionNumber10_1_4 = 227.3;
+
+const double kCFCoreFoundationVersionNumber10_2 = 263.0;
+
+const double kCFCoreFoundationVersionNumber10_2_1 = 263.1;
+
+const double kCFCoreFoundationVersionNumber10_2_2 = 263.1;
+
+const double kCFCoreFoundationVersionNumber10_2_3 = 263.3;
+
+const double kCFCoreFoundationVersionNumber10_2_4 = 263.3;
+
+const double kCFCoreFoundationVersionNumber10_2_5 = 263.5;
+
+const double kCFCoreFoundationVersionNumber10_2_6 = 263.5;
+
+const double kCFCoreFoundationVersionNumber10_2_7 = 263.5;
+
+const double kCFCoreFoundationVersionNumber10_2_8 = 263.5;
+
+const double kCFCoreFoundationVersionNumber10_3 = 299.0;
+
+const double kCFCoreFoundationVersionNumber10_3_1 = 299.0;
+
+const double kCFCoreFoundationVersionNumber10_3_2 = 299.0;
+
+const double kCFCoreFoundationVersionNumber10_3_3 = 299.3;
+
+const double kCFCoreFoundationVersionNumber10_3_4 = 299.31;
+
+const double kCFCoreFoundationVersionNumber10_3_5 = 299.31;
+
+const double kCFCoreFoundationVersionNumber10_3_6 = 299.32;
+
+const double kCFCoreFoundationVersionNumber10_3_7 = 299.33;
+
+const double kCFCoreFoundationVersionNumber10_3_8 = 299.33;
+
+const double kCFCoreFoundationVersionNumber10_3_9 = 299.35;
+
+const double kCFCoreFoundationVersionNumber10_4 = 368.0;
+
+const double kCFCoreFoundationVersionNumber10_4_1 = 368.1;
+
+const double kCFCoreFoundationVersionNumber10_4_2 = 368.11;
+
+const double kCFCoreFoundationVersionNumber10_4_3 = 368.18;
+
+const double kCFCoreFoundationVersionNumber10_4_4_Intel = 368.26;
+
+const double kCFCoreFoundationVersionNumber10_4_4_PowerPC = 368.25;
+
+const double kCFCoreFoundationVersionNumber10_4_5_Intel = 368.26;
+
+const double kCFCoreFoundationVersionNumber10_4_5_PowerPC = 368.25;
+
+const double kCFCoreFoundationVersionNumber10_4_6_Intel = 368.26;
+
+const double kCFCoreFoundationVersionNumber10_4_6_PowerPC = 368.25;
+
+const double kCFCoreFoundationVersionNumber10_4_7 = 368.27;
+
+const double kCFCoreFoundationVersionNumber10_4_8 = 368.27;
+
+const double kCFCoreFoundationVersionNumber10_4_9 = 368.28;
+
+const double kCFCoreFoundationVersionNumber10_4_10 = 368.28;
+
+const double kCFCoreFoundationVersionNumber10_4_11 = 368.31;
+
+const double kCFCoreFoundationVersionNumber10_5 = 476.0;
+
+const double kCFCoreFoundationVersionNumber10_5_1 = 476.0;
+
+const double kCFCoreFoundationVersionNumber10_5_2 = 476.1;
+
+const double kCFCoreFoundationVersionNumber10_5_3 = 476.13;
+
+const double kCFCoreFoundationVersionNumber10_5_4 = 476.14;
+
+const double kCFCoreFoundationVersionNumber10_5_5 = 476.15;
+
+const double kCFCoreFoundationVersionNumber10_5_6 = 476.17;
+
+const double kCFCoreFoundationVersionNumber10_5_7 = 476.18;
+
+const double kCFCoreFoundationVersionNumber10_5_8 = 476.19;
+
+const double kCFCoreFoundationVersionNumber10_6 = 550.0;
+
+const double kCFCoreFoundationVersionNumber10_6_1 = 550.0;
+
+const double kCFCoreFoundationVersionNumber10_6_2 = 550.13;
+
+const double kCFCoreFoundationVersionNumber10_6_3 = 550.19;
+
+const double kCFCoreFoundationVersionNumber10_6_4 = 550.29;
+
+const double kCFCoreFoundationVersionNumber10_6_5 = 550.42;
+
+const double kCFCoreFoundationVersionNumber10_6_6 = 550.42;
+
+const double kCFCoreFoundationVersionNumber10_6_7 = 550.42;
+
+const double kCFCoreFoundationVersionNumber10_6_8 = 550.43;
+
+const double kCFCoreFoundationVersionNumber10_7 = 635.0;
+
+const double kCFCoreFoundationVersionNumber10_7_1 = 635.0;
+
+const double kCFCoreFoundationVersionNumber10_7_2 = 635.15;
+
+const double kCFCoreFoundationVersionNumber10_7_3 = 635.19;
+
+const double kCFCoreFoundationVersionNumber10_7_4 = 635.21;
+
+const double kCFCoreFoundationVersionNumber10_7_5 = 635.21;
+
+const double kCFCoreFoundationVersionNumber10_8 = 744.0;
+
+const double kCFCoreFoundationVersionNumber10_8_1 = 744.0;
+
+const double kCFCoreFoundationVersionNumber10_8_2 = 744.12;
+
+const double kCFCoreFoundationVersionNumber10_8_3 = 744.18;
+
+const double kCFCoreFoundationVersionNumber10_8_4 = 744.19;
+
+const double kCFCoreFoundationVersionNumber10_9 = 855.11;
+
+const double kCFCoreFoundationVersionNumber10_9_1 = 855.11;
+
+const double kCFCoreFoundationVersionNumber10_9_2 = 855.14;
+
+const double kCFCoreFoundationVersionNumber10_10 = 1151.16;
+
+const double kCFCoreFoundationVersionNumber10_10_1 = 1151.16;
+
+const int kCFCoreFoundationVersionNumber10_10_2 = 1152;
+
+const double kCFCoreFoundationVersionNumber10_10_3 = 1153.18;
+
+const double kCFCoreFoundationVersionNumber10_10_4 = 1153.18;
+
+const double kCFCoreFoundationVersionNumber10_10_5 = 1153.18;
+
+const int kCFCoreFoundationVersionNumber10_10_Max = 1199;
+
+const int kCFCoreFoundationVersionNumber10_11 = 1253;
+
+const double kCFCoreFoundationVersionNumber10_11_1 = 1255.1;
+
+const double kCFCoreFoundationVersionNumber10_11_2 = 1256.14;
+
+const double kCFCoreFoundationVersionNumber10_11_3 = 1256.14;
+
+const double kCFCoreFoundationVersionNumber10_11_4 = 1258.1;
+
+const int kCFCoreFoundationVersionNumber10_11_Max = 1299;
+
+const int ISA_PTRAUTH_DISCRIMINATOR = 27361;
diff --git a/pkgs/ffigen/test/native_objc_test/setup.dart b/pkgs/ffigen/test/native_objc_test/setup.dart
new file mode 100644
index 0000000..c9dbf05
--- /dev/null
+++ b/pkgs/ffigen/test/native_objc_test/setup.dart
@@ -0,0 +1,36 @@
+// Copyright (c) 2022, 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:async';
+import 'dart:io';
+
+Future<void> _buildLib(String input, String output) async {
+  final args = [
+    '-shared',
+    '-fpic',
+    '-x',
+    'objective-c',
+    input,
+    '-framework',
+    'Foundation',
+    '-o',
+    output,
+  ];
+  final process = await Process.start('clang', args);
+  unawaited(stdout.addStream(process.stdout));
+  unawaited(stderr.addStream(process.stderr));
+  final result = await process.exitCode;
+  if (result != 0) {
+    throw ProcessException('clang', args, 'Build failed', result);
+  }
+  print('Generated file: $output');
+}
+
+Future<void> main(List<String> arguments) async {
+  if (!Platform.isMacOS) {
+    throw OSError('Objective C tests are only supported on MacOS');
+  }
+  print('Building Dynamic Library for Objective C Native Tests...');
+  await _buildLib('native_objc_test.m', 'native_objc_test.dylib');
+}
diff --git a/pkgs/ffigen/test/setup.dart b/pkgs/ffigen/test/setup.dart
new file mode 100644
index 0000000..e660598
--- /dev/null
+++ b/pkgs/ffigen/test/setup.dart
@@ -0,0 +1,36 @@
+// Copyright (c) 2022, 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.
+
+// Runs all the test setup scripts. Usage:
+// dart run test/setup.dart
+
+import 'dart:async';
+import 'dart:io';
+
+import 'package:path/path.dart' as path;
+
+Future<void> _run(String subdir, String script) async {
+  final dir = path.join(path.dirname(Platform.script.path), subdir);
+  print('\nRunning $script in $dir');
+  final args = ['run', path.join(dir, script)];
+  final process = await Process.start(
+    Platform.executable,
+    args,
+    workingDirectory: dir,
+  );
+  unawaited(stdout.addStream(process.stdout));
+  unawaited(stderr.addStream(process.stderr));
+  final result = await process.exitCode;
+  if (result != 0) {
+    throw ProcessException(Platform.executable, args, '$script failed', result);
+  }
+}
+
+Future<void> main() async {
+  await _run('native_test', 'build_test_dylib.dart');
+  if (Platform.isMacOS) {
+    await _run('native_objc_test', 'setup.dart');
+  }
+  print('\nSuccess :)\n');
+}