dylo-runtime

Crates.iodylo-runtime
lib.rsdylo-runtime
version
sourcesrc
created_at2024-12-05 19:30:56.215212
updated_at2024-12-06 18:07:55.581032
descriptionDynamic library loader for con traits
homepage
repositoryhttps://github.com/bearcove/dylo
max_upload_size
id1473538
Cargo.toml error:TOML parse error at line 19, column 1 | 19 | autolib = false | ^^^^^^^ unknown field `autolib`, expected one of `name`, `version`, `edition`, `authors`, `description`, `readme`, `license`, `repository`, `homepage`, `documentation`, `build`, `resolver`, `links`, `default-run`, `default_dash_run`, `rust-version`, `rust_dash_version`, `rust_version`, `license-file`, `license_dash_file`, `license_file`, `licenseFile`, `license_capital_file`, `forced-target`, `forced_dash_target`, `autobins`, `autotests`, `autoexamples`, `autobenches`, `publish`, `metadata`, `keywords`, `categories`, `exclude`, `include`
size0
Amos Wenger (fasterthanlime)

documentation

README

license: MIT/Apache-2.0 crates.io docs.rs

dylo-runtime

dylo-runtime provides supporting code for the con crate, handling module building and loading on MacOS and Linux. End users shouldn't need to use this crate directly - it exists as a dependency of the con crate and crates generated by the dylo-runtime tool.

However, this is the right place to learn about environment variables that will impact the behavior of dylo-runtime:

  • DYLO_TARGET_DIR: Set the build directory for hot-reloadable plugins. By default, plugins are built into $HOME/.dylo-mods/{mod-name} or %USERPROFILE%\.dylo-mods\{mod-name} on Windows.

  • DYLO_BUILD: Set to "0" to disable automatic mod compilation. Defaults to "1". Set to "verbose" to have cargo inherit stdout/stderr, which will show progress messages and colors.

In production, you probably want DYLO_BUILD to be set to 0, as your mods should be pre-built, and put in the right place, next to the executable.

Warning Make sure to build your mods with the dylo-runtime/import-globals and impl features enabled, just like dylo-runtime would do.

See the rubicon docs for more details: essentially, your mods need to refer to the same process-local and thread-local variables that your main app does, or stuff like tokio etc. will break.

That is, if your Cargo workspace looks like this:

workspace/
  Cargo.toml
  mods/
    mod-markdown/
    mod-clap/
    con-markdown/
    con-clap/
  app/
    Cargo.toml
    src/lib.rs etc.

Then dylo-runtime expects a file hierarchy like this:

workspace/
  target/
    debug/
      app
      libmod_markdown.dylib
      libmod_clap.dylib

Except it doesn't actually need to be in target/debug/ of anywhere — this could all be in a container image under /app or whatever.

ABI Safety

dylo uses rubicon to ensure that the ABI of the module matches the ABI of the app they're being loaded into.

If you mess something up, you should get a detailed panic with colors and emojis explaining exactly what you got wrong.

Note that if you need crates like tokio, tracing, eyre, etc. you should use their patched versions, see the rubicon compatibility tracker.

Commit count: 34

cargo fmt