instantiations / es_compression

Compression framework for Dart providing FFI implementations for Brotli, Lz4, Zstd (Zstandard) with ready-to-use prebuilt binaries for Win/Linux/Mac.
https://www.instantiations.com
BSD 3-Clause "New" or "Revised" License
41 stars 8 forks source link

[ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: Invalid argument(s): Failed to load dynamic library 'eslz4-win64.dll': The specified module could not be found. #47

Closed riccardo-runci closed 7 months ago

riccardo-runci commented 8 months ago

I'm trying to use this package in windows flutter app and i get this error

[ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: Invalid argument(s): Failed to load dynamic library 'eslz4-win64.dll': The specified module could not be found.

code from flutter


    final codec = Lz4Codec();

    print('Lz4 Encoder Version: ${codec.libraryVersion}');

    // One-shot encode/decode
    final encoded = codec.encode(randomBytes);
    var decoded = codec.decode(encoded);
    final oneShotResult =
        verifyEquality(randomBytes, decoded, header: 'One-shot: ');

    // Streaming encode/decode
    // Split the random bytes into 10 buckets
    final chunks = splitIntoChunks(randomBytes, 10);
    final randomStream = Stream.fromIterable(chunks);
    decoded = await randomStream
        .transform(codec.encoder)
        .transform(codec.decoder)
        .fold<List<int>>(<int>[], (buffer, data) {
      buffer.addAll(data);
      return buffer;
    });
    final streamResult =
        verifyEquality(randomBytes, decoded, header: 'Streaming: ');
    return (oneShotResult == true && streamResult == true) ? 0 : -1;
  }```
sethloco commented 8 months ago

The code looks fine to me, but it looks like adjustments need to be made to the Flutter project to describe where to load the dlls from, as the error indicates that it is unable to locate it.

I don’t know Flutter very well, but I imagine there is a location where it expects dlls to be located when a call to dlopen() or equivalent is made?