WsNativeLibrary.open constructor
WsNativeLibrary.open(
- String path
Loads the library from path and checks it.
Throws ArgumentError if the file cannot be loaded (missing, wrong
architecture, or not this library) and UnsupportedError if it was
built for another version of ws.
Implementation
factory WsNativeLibrary.open(String path) {
final lib = DynamicLibrary.open(path);
final NativeSymbols symbols;
try {
symbols = NativeSymbols.lookup(lib.lookup);
// A missing symbol is reported as ArgumentError.
// ignore: avoid_catching_errors
} on ArgumentError catch (e) {
throw ArgumentError.value(
path,
'path',
'not a ws_native library (${e.message})',
);
}
return WsNativeLibrary.fromSymbols(symbols);
}