ArgoxPPLA constructor
ArgoxPPLA()
The symbols are looked up in dynamicLibrary
.
Constructor loads library straight from plugin path
Implementation
// ArgoxPPLA(ffi.DynamicLibrary dynamicLibrary)
// : _lookup = dynamicLibrary.lookup;
/// Constructor loads library straight from plugin path
ArgoxPPLA() {
/// Run path means you are running $ flutter run
/// And loads .DLL files straight from current directory
String _runPath = [Directory.current.path, 'windows'].join('\\');
/// Exe path means you are running a build executable
String _exePath = [
File(Platform.resolvedExecutable).parent.path,
'data',
'flutter_assets',
'packages',
'argox_printer',
'windows'
].join('\\');
/// Now that there are 2 paths, we try load library from 3 points, both
/// paths and also from system32 (direct call)
/// If neither of then are loaded will be thrown an exception
ffi.DynamicLibrary _library;
try {
_library = ffi.DynamicLibrary.open([_runPath, _dll].join('\\'));
} catch (e) {
try {
_library = ffi.DynamicLibrary.open([_exePath, _dll].join('\\'));
} catch (e) {
_library = ffi.DynamicLibrary.open(_dll);
}
}
_lookup = _library.lookup;
}