This is C and I tossed it together VERY quickly but
$ cat hello.rs
#[no_mangle]
pub extern fn plus_one(x: isize) -> isize {
x + 1
}
$ cat hello.c
#include<stdio.h>
extern int plus_one(int);
int main() {
int result = plus_one(5);
printf("result is %d\n", result);
return 0;
}
$ rustc hello.rs --crate-type=dylib
$ gcc hello.c -lhello -L .
$ LD_LIBRARY_PATH=. ./a.out
result is 6