How to set dynamic linking dependency in rust?

How to set dynamic linking for dependency in Cargo.toml?
It is possible?

What kind of dependency? Is this a rust crate or bindings for C code?

I mean the libmodbus-rs library. Its crate and bindings for C.
I need compile my example with dynamic linking libmobus library.

The build script from the libmodbus-sys crate does not seem to support dynamic linking.

How to fix it?

It's not an easy fix. You could try to follow this guide to creating -sys crates to fix the build script from the libmodbus-sys crate, then use the [patch] feature descriped here to replace it with your fixed version.

1 Like