Hi All,
I have been learning Rust for couple of months now and I started using Workspace. I have broken my modules to lib so that compile time reduces and I can use python with FFI. Strangely, I am getting an build error. is it possible to avoid this error?
├── Cargo.lock
├── Cargo.toml
├── lib_1
│ ├── Cargo.toml
│ └── src
│ └── lib.rs
├── lib_2
│ ├── Cargo.toml
│ └── src
│ └── lib.rs
├── my_app
│ ├── Cargo.toml
│ └── src
│ └── main.rs
└── target
Then, I have below function in lib_1
// lib_1/src/lib.rs
#[no_mangle]
pub extern "C" fn get_as_json(path: *const c_char) -> *mut c_char {
// Do my code for lib_1
}
Likewise, in lib_2,
// lib_2/src/lib.rs
#[no_mangle]
pub extern "C" fn get_as_json(path: *const c_char) -> *mut c_char {
// Do my code for lib_2
}
When I do cargo build
, I am getting below error
liblib_1.rlib(lib_1.210c57avucod57l9.rcgu.o) : error LNK2005: get_as_json already defined in liblib_2.rlib(lib_2.55by53wmm0ypf63d.rcgu.o)