24 lines
571 B
Rust
24 lines
571 B
Rust
/*
|
|
$ rustc --crate-type=lib rary.rs
|
|
$ ls lib*
|
|
library.rlib
|
|
|
|
// extern crate rary; // May be required for Rust 2015 edition or earlier
|
|
|
|
fn main() {
|
|
rary::public_function();
|
|
|
|
// Error! `private_function` is private
|
|
//rary::private_function();
|
|
|
|
rary::indirect_access();
|
|
}
|
|
|
|
# Where library.rlib is the path to the compiled library, assumed that it's
|
|
# in the same directory here:
|
|
$ rustc executable.rs --extern rary=library.rlib && ./executable
|
|
called rary's `public_function()`
|
|
called rary's `indirect_access()`, that
|
|
> called rary's `private_function()`
|
|
*/
|