Modulinos: Difference between revisions

Added Rust
m (change header from Freepascal, which does not exist, to Pascal and add a works-with)
(Added Rust)
Line 1,263:
puts "Life means #{meaning_of_life}."
puts "Death means invisible scary skeletons."</lang>
 
=={{header|Rust}}==
Makefile:
<lang make>all: scriptedmain
 
scriptedmain: scriptedmain.rs
rustc scriptedmain.rs
 
test: test.rs scriptedmain.rs
rustc --lib scriptedmain.rs
rustc test.rs -L .
 
clean:
-rm test
-rm -rf *.dylib
-rm scriptedmain
-rm -rf *.dSYM</lang>
 
scriptedmain.rs:
<lang rust>#[link(name = "scriptedmain")];
 
use std;
 
fn meaningOfLife() -> int {
ret 42;
}
 
fn main() {
std::io::println("Main: The meaning of life is " + core::int::to_str(meaningOfLife(), 10u));
}</lang>
 
test.rs:
<lang rust>use scriptedmain;
use std;
 
fn main() {
std::io::println("Test: The meaning of life is " + core::int::to_str(scriptedmain::meaningOfLife(), 10u));
}</lang>
 
Example:
<lang sh>$ make
rustc scriptedmain.rs
$ make test
rustc --lib scriptedmain.rs
rustc test.rs -L .
$ ./scriptedmain
Main: The meaning of life is 42
$ ./test
Test: The meaning of life is 42
 
=={{header|SAC}}==
Anonymous user