No -c no main()

Mike Parker aldacron at gmail.com
Thu Mar 19 16:23:08 PDT 2009


Yigal Chripun wrote:
> On 19/03/2009 12:19, Walter Bright wrote:
>> It's a good idea. Please add to bugzilla as an enhancement request!
> 
> another thing that can be done is provide a compiler flag to specify the 
> module that contains main() so the compiler will use that specific main 
> and ignore all others. this is similar to how you specify the class with 
> main() method in Java. Jar files have a manifest with this info and in 
> Eclipse you specify the class in the Run dialog. I don't remember how it 
> works with the command line (actually, I don't remember ever using the 
> command line with Java)

It's not something that happens at compile time. All existing main 
methods are compiled into their respective class files. From the command 
line, you execute the JRE (java or javaw in Sun's case) and pass it the 
name of the class you want to execute. If the class has a main method, 
it is called. If not, you get an error.



More information about the Digitalmars-d mailing list