rust - How to link main.rs to lib.rs dynamically? -


i have crate both src/lib.rs , src/main.rs.

main.rs using extern crate programname (which lib.rs) , uses functions lib.rs , it's submodules.

the documentation on linking says:

pure-rust dependencies statically linked default can use created binaries , libraries without installing rust everywhere.

how can change behavior binary created main.rs dynamically linked library produced lib.rs?

i've added following cargo.toml

[lib] path = "src/lib.rs" crate-type = ["dylib"]  [[bin]] name = "programname" path = "src/main.rs" 

but not compile , gives me errors like:

error: cannot satisfy dependencies `std` shows once help: having upstream crates available in 1 format make go away 

if add "rlib" lib section, compiles, binary not linked against libprogramname.so


Comments

Popular posts from this blog

Spring Boot + JPA + Hibernate: Unable to locate persister -

go - Golang: panic: runtime error: invalid memory address or nil pointer dereference using bufio.Scanner -

c - double free or corruption (fasttop) -