overloading main

Imperatorn johan_forsberg_86 at hotmail.com
Sun Oct 30 16:31:45 UTC 2022


On Sunday, 30 October 2022 at 16:09:54 UTC, NonNull wrote:
> I am linking to a C project with some C already automatically 
> translated into D including the C main function `int main(int 
> argc, char** argv){/* ... */}` which I wanted to call from a D 
> main function in a new module. But then I found that the former 
> C main in D will not compile! ldc2 complains that main must 
> only have prototypes as if it is the entry point. So it seems 
> that main cannot be overloaded with a prototype that is not a 
> valid entry point in D. Is this restriction essential? And if 
> not, why make it?

You should not have multiple mains. Rename it and call it


More information about the Digitalmars-d-learn mailing list