errno_location_addr property

Pointer<NativeFunction<Pointer<Int32> Function()>> errno_location_addr
latefinal

Implementation

late final ffi.Pointer<ffi.NativeFunction<ffi.Pointer<ffi.Int32> Function()>> errno_location_addr = (() {
  ffi.Pointer<ffi.NativeFunction<ffi.Pointer<ffi.Int32> Function()>>? tryLookup(String name) {
    try {
      return _lookup<ffi.NativeFunction<ffi.Pointer<ffi.Int32> Function()>>(name);
    } on ArgumentError {
      return null;
    }
  }

  ffi.Pointer<ffi.NativeFunction<ffi.Pointer<ffi.Int32> Function()>> throwStateError() {
    throw StateError('Couldn\'t resolve the errno location function.');
  }

  return tryLookup('__errno_location') ??
      tryLookup('__errno') ??
      tryLookup('errno') ??
      tryLookup('_dl_errno') ??
      tryLookup('__libc_errno') ??
      throwStateError();
})();