I have a rust project that I am compiling for by rpi4. The pkg produces 2 bin and 1 lib (rust allows only 1 lib). The Cargo.toml for the project looks like the following:
[package]
name = "rpi4_cross_compile"
version = "0.1.0"
edition = "2021"
links = "atomic"
default-run = "rust_hello_world_elf"
[[bin]]
name = "rust_atomic_elf"
path = "src/bin/atomic.rs"
[[bin]]
name = "rust_hello_world_elf"
path = "src/bin/hello_world.rs"
[lib]
name = "foo"
crate-type = ["cdylib"]
[dependencies]
libc = "0.2.155"
How do I access the foo
lib inside my 2 bin crates and link against the so
file produced by the lib ?
The cdylib exports a simple function onload
for testing purposes. Is this even possible ? I do not want to export lib as a "rlib" type. How does one consume a cdylib produced by a pkg within the same pkg for bin/test/benchmark crates/purposes ?