overloading main

NonNull non-null at use.startmail.com
Sun Oct 30 16:09:54 UTC 2022


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?


More information about the Digitalmars-d-learn mailing list