import 'dart:ffi' as ffi;
import 'package:ffi/ffi.dart';
import 'package:posix/src/unistd/libc.dart';
/// Holds the Dynamic library.
ffi.DynamicLibrary _dylib;
void main() {
var path = 'libc.so.6';
_dylib = ffi.DynamicLibrary.open(path);
print(Utf8.fromUtf8(strerror(2).cast()));
}
/// Return a string describing the meaning of the `errno' code in ERRNUM.
ffi.Pointer<ffi.Int8> strerror(
int __errnum,
) {
var _strerror =
Libc().dylib.lookupFunction<_c_strerror, _dart_strerror>('strerror');
return _strerror(
__errnum,
);
}
typedef _c_strerror = ffi.Pointer<ffi.Int8> Function(
ffi.Int32 __errnum,
);
typedef _dart_strerror = ffi.Pointer<ffi.Int8> Function(
int __errnum,
);