Skip to content

Commit

Permalink
Update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
temeddix committed Jun 1, 2024
1 parent 463cff5 commit 5f30cb9
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions documentation/docs/frequently-asked-questions.md
Original file line number Diff line number Diff line change
Expand Up @@ -308,3 +308,25 @@ These links might be a help:
- https://kazlauskas.me/entries/writing-proper-buildrs-scripts
- https://github.com/RustAudio/rodio/issues/404
- https://github.com/breez/c-breez/issues/553

### How do I set the path to a compiled dynamic library?

You might want to run your app on embedded devices. However, you may encounter this error when running your app on a non-major platform:

```
Failed to load dynamic library 'libhub.so': libhub.so: cannot open shared object file: No such file or directory
```

In this case, you can specify a path that points to the compiled Rust library. Simply provide a string path to your dynamic library file.

```dart title="lib/main.dart"
import './messages/generated.dart';
async void main() {
await initializeRust(compiledLibPath: "/path/to/library/libhub.so");
...
}
...
```

This provided path will be used for finding dynamic library files on native platforms with Dart's `DynamicLibrary.open([compiledLibPath])`, and for loading the JavaScript module on the web with `import init, * as wasmBindings from "[compiledLibPath]"`.

0 comments on commit 5f30cb9

Please sign in to comment.