On Friday, 18 November 2016 at 07:51:35 UTC, deadalnix wrote:
On Wednesday, 26 October 2016 at 21:57:59 UTC, Basile B. wrote:
It looks fairly simple to do in dmd, like this (with breakage
in case the user-defined main() did something useful):
1. deactivate the main functionDeclaration un funcs.d
[...]
2. forces -main in params.d:
[...]
I see no reason to discuss much about this. People that are
pro should just agree on how this should be done and someone
makes a PR.
Maybe the little issue would be with LDMD2 and GDMD. Since
these programs are just bridges they cannot do point 1, and
LDC2 and GDC would have to follow this behavior.
I tried that and it doesn't work. addMain actualy just inject a
main function as a mixin in the module. Yes this is a string,
it is parsed and all.
Sorry to learn that. To be honest I didn't try. For now and since
three or four months I use an IDE solution. It detects the main()
function and sets the -main switch accordingly. Anyway I would
prefer something similar directly in the compiler.
The problem is that this function that is injected is then not
wired in as main, because isMain returns false.
Any tips appreciated.