Files
rust/tests/run-make/extern-fn-reachable/dylib.rs
许杰友 Jieyou Xu (Joe) 98f673e93a tests: port extern-fn-reachable to rmake.rs
Co-authored-by: binarycat <binarycat@envs.net>
2025-01-15 01:05:16 +08:00

35 lines
1013 B
Rust

#![crate_type = "dylib"]
#![allow(dead_code)]
// `pub` extern fn here is a Rust nameres visibility concept, and should not affect symbol
// visibility in the dylib.
#[no_mangle]
pub extern "C" fn fun1() {}
// (Lack of) `pub` for the extern fn here is a Rust nameres visibility concept, and should not
// affect symbol visibility in the dylib.
#[no_mangle]
extern "C" fn fun2() {}
// Modules are a Rust nameres concept, and should not affect symbol visibility in the dylib if the
// extern fn is nested inside a module.
mod foo {
#[no_mangle]
pub extern "C" fn fun3() {}
}
// Similarly, the Rust visibility of the containing module is a Rust nameres concept, and should not
// affect symbol visibility in the dylib.
pub mod bar {
#[no_mangle]
pub extern "C" fn fun4() {}
}
// Non-extern `#[no_mangle]` fn should induce a symbol visible in the dylib.
#[no_mangle]
pub fn fun5() {}
// The Rust visibility of the fn should not affect is symbol visibility in the dylib.
#[no_mangle]
fn fun6() {}