Jon Griffiths wrote:
any reason why not use DllMain instead of patching winebuild ?
If you mean the DllMain of msvcrt, there is no way for the it to know what type of app is calling it AFAICS. Only the generated main knows, and should inform msvcrt when it starts. Also the handling of main() is different for natively build apps linked with msvcrt: they should eventually have a different loop than ExitProcess(main())
Some of these settings can be overriden and should be handled by the .exe file. Wildcard expansion and the user math errors come to mind.
but in most of the cases, this is a linker issue (overriding in user's compilation units symbols which come from libraries - in this case the C runtime libraries) perhaps a better way would be to add another layer: - instead of calling directly the user defined main function, then call another one, which would perform the next initialization steps (main vs. wmain calling, _matherr overriding, command line expansion...) A+