Currently on Windows,
mainCRTStartup is run before the Rust std internal main (which in turn calls the application's main function). This initializes the C/C++ runtime. However, as far as I understand it, Rust handles things like setting up the main thread and SEH exceptions. Rust is also very insistent that there shouldn't be any constructors run before the application's main (aka no life before main) so there's no issue with trying to ensure constructors are initialized before the application's main is called. The Microsoft docs make mention of calling
__security_init_cookie but I think Rust has its own stack guard.
So I'm wondering if
mainCRTStartup does anything that's useful for Rust? I'm finding it hard to find definitive information on this. My tests so far don't show a problem with replacing the entry point with a stub that simply calls Rust's internal std main directly but I may well be missing something very important.