Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upTracking issue for the `start` feature #29633
Comments
aturon
added
T-lang
B-unstable
labels
Nov 5, 2015
This comment has been minimized.
This comment has been minimized.
|
I believe the semantics of this today are that the compiler will generate a function with the symbol The signature for this function is also |
This comment has been minimized.
This comment has been minimized.
|
On Windows the executable entry point does not take any arguments. Currently we let the CRT act as the executable entry point which then calls our Rust entry wrapper which invokes the start function which is either |
This comment has been minimized.
This comment has been minimized.
|
html5ever uses in an ugly hack that overrides the This would be better solved by some way to override the test harness used by |
This comment has been minimized.
This comment has been minimized.
|
@SimonSapin the use case for that with Cargo should in theory be |
This comment has been minimized.
This comment has been minimized.
|
The Is there a tracking issue for |
This comment has been minimized.
This comment has been minimized.
|
Oh that's already implemented today, if a test target is listed as (this may be a bit off-topic from |
This comment has been minimized.
This comment has been minimized.
|
The current signature for the lang item is fn lang_start(main: *const u8, argc: isize, argv: *const *const u8) -> isize {which is called by a generated main function. Instead, the signatures of both should be arbitrary and the symbols translate to |
This comment has been minimized.
This comment has been minimized.
|
Note that on windows it really shouldn't always be |
steveklabnik
referenced this issue
Jun 6, 2016
Closed
start / generated C main is the wrong type #20064
This comment has been minimized.
This comment has been minimized.
|
#20064 suggests that the signature here is wrong, we should consider this before making this feature stable. |
This comment has been minimized.
This comment has been minimized.
|
Just to clarify, it's not just a question of what signature
Of course this would be an easy fix. |
This comment has been minimized.
This comment has been minimized.
|
Just don't stabilize this until consideration is taken for subsystems, which change the entry point completely from |
This comment has been minimized.
This comment has been minimized.
|
Entry point name is irrelevant for windows apps actually. Ability to specify subsystem is one of important things to create application, because most of them are gui with "windows" subsystem. |
Mark-Simulacrum
added
the
C-tracking-issue
label
Jul 22, 2017
bors
added a commit
that referenced
this issue
Oct 1, 2017
bors
added a commit
that referenced
this issue
Oct 1, 2017
This comment has been minimized.
This comment has been minimized.
|
Pinging this thread since it seems inactive. I wanted to express interest in this feature being stabilized. I was really excited when I discovered that you could replace the entry point in Rust, and then real bummed when I found out that you could only do it on nightly. |
This comment has been minimized.
This comment has been minimized.
|
It's also necessary to write #![no_std] programs. |
This comment has been minimized.
This comment has been minimized.
|
I would expect |
This comment has been minimized.
This comment has been minimized.
Speaking of which… is there any reason for this? We could make a version of Personally, instead of offering |
This comment has been minimized.
This comment has been minimized.
|
@glandium The binary entry point is completely different from @clarcharr Adding some form of |
This comment has been minimized.
This comment has been minimized.
|
I've just been using I just define my main function with |
This comment has been minimized.
This comment has been minimized.
|
@retep998 Oh, I didn't know that. I think that in that case, it makes sense to simply have a That was initially the idea but I didn't realise how windows did things. |
This comment has been minimized.
This comment has been minimized.
Indeed, it surprisingly works on linux, mac and even windows, with a |
This comment has been minimized.
This comment has been minimized.
|
#![no_main]
#[no_mangle]
pub fn main(args: Vec<String>) {
for arg in args {
println!("{}", arg);
}
} |
This comment has been minimized.
This comment has been minimized.
|
The current signature for |
aturon commentedNov 5, 2015
Tracking issue for
#[start], which indicates that a function should be used as the entry point, overriding the "start" language item. In general this forgoes a bit of runtime setup that's normally run before and after main.