loadCLAIDLibrary method

void loadCLAIDLibrary()

The dynamic library in which the symbols for ClaidCoreBindings can be found.

Implementation

void loadCLAIDLibrary()
{
  ffi.DynamicLibrary? library;
  if (Platform.isMacOS || Platform.isIOS)
  {

    String path = _libraryPath != "" ? _libraryPath : "../../dispatch/dart/claid/blobs/lib$_libName.dylib";
      print("LibraryPath $path");

    if(!File(path).existsSync())
    {
      path = "blobs/lib$_libName.dylib";
    }
    library = ffi.DynamicLibrary.open(path);
  }
  if (Platform.isLinux)
  {
      String path = _libraryPath != "" ? _libraryPath : "../../dispatch/dart/claid/blobs/lib${_libName}_${_platform}.so";

    if(!File(path).existsSync())
    {
      path = "blobs/lib${_libName}_${_platform}.so";
    }
    library = ffi.DynamicLibrary.open(path);
  }
  if (Platform.isAndroid)
  {
    library = ffi.DynamicLibrary.open('libclaid_capi_android.so');
  }
  if (Platform.isWindows)
  {
    library = ffi.DynamicLibrary.open('$_libName.dll');
  }

  if(library != null)
  {
    _dyLib = library;
    _bindings = ClaidCoreBindings(_dyLib);
    return;
  }
  throw UnsupportedError('Unknown platform: ${Platform.operatingSystem}');
}