about summary refs log tree commit diff
path: root/src/rustllvm/RustWrapper.cpp
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2013-04-12 02:34:02 -0700
committerbors <bors@rust-lang.org>2013-04-12 02:34:02 -0700
commit63e2724cdb42c97051f03b10b644aed6df7cfa72 (patch)
treef22010e9ad72874bc47a297a9a5160de246fbc59 /src/rustllvm/RustWrapper.cpp
parent9db15f321598b5c3f246b284ab1c1daffae9e145 (diff)
parent35c73c80887cca62f8bba2eb9b9e277a98c37f93 (diff)
downloadrust-63e2724cdb42c97051f03b10b644aed6df7cfa72.tar.gz
rust-63e2724cdb42c97051f03b10b644aed6df7cfa72.zip
auto merge of #5809 : Aatch/rust/start-attr, r=thestinger
This implements #5158. Currently it takes the command line args and the crate map. Since it doesn't take a `main` function pointer, you can't actually start the runtime easily, but that seems to be a shim to allow the current `rust_start` function to call into main.

However, you can do an end-run round the io library and do this:

```rust
use core::libc::{write, c_int, c_void, size_t, STDOUT_FILENO};

#[start]
fn my_start(_argc:int, _argv: **u8, _crate_map: *u8) -> int {
    do str::as_buf("Hello World!\n") |s,len| {
        unsafe {
            write(STDOUT_FILENO, s as *c_void, len as size_t);
        }
    }
    return 0;
}
```

Which is the most basic "Hello World" you can do in rust without starting up the runtime (though that has quite a lot to do with the fact that `core::io` uses `@` everywhere...)
Diffstat (limited to 'src/rustllvm/RustWrapper.cpp')
0 files changed, 0 insertions, 0 deletions