colgm/test/self-ref-test.colgm

27 lines
429 B
Rust

use libc::{ puts, malloc };
struct str {
c_str: i8*
}
struct wrap {
string: str
}
impl str {
pub func dump(self) {
puts(self->c_str);
return;
}
}
func main() -> i32 {
var consts = "[self-ref-test] hello world!";
var w = wrap::__alloc__();
w->string.c_str = consts;
puts(consts);
puts(w->string.c_str);
w->string.dump();
return 0 => i32;
}