I have something that looks like
// crateA/lib.rs
#[cfg(not(test))]
extern "C" {
fn ext_fn();
}
#[cfg(test)]
fn ext_fn() {
unimplemented!();
}
pub fn do_ext() {
unsafe { ext_fn() };
}
// crateB/lib.rs
crateA::do_ext()
but despite using cargo test, I still get a link error saying that ext_fn isn't found. Is #[cfg(not(test))] a valid attribute?
I have something that looks like
but despite using
cargo test, I still get a link error saying thatext_fnisn't found. Is#[cfg(not(test))]a valid attribute?