program arguments in module constructor?
Derek Parnell
derek at psych.ward
Tue May 16 17:13:56 PDT 2006
On Tue, 16 May 2006 20:02:51 +0200, Johan Granberg wrote:
> Can this bee done?
>
> //file.d
> static this()
> {
> char[][] args=getArgs();//
> someFunk(args);
> }
>
> void main(char[][] args)
> {
> runProgram();
> }
> //end of file
>
> Basically i want to access the args argument passed to main before main
> is called. I think that when we have module constructors we should bee
> able to do this (if we already can pleas tell me).
>
> (The problem i try to solve is working around the SDLmain hack to
> initialize SDL in the module constructor of my library so that when main
> is called the SDL will already bee initialized)
I don't understand what is the effective difference between what you want
and ...
//file.d
void main(char[][] args)
{
someFunk(args);
runProgram();
}
//end of file
Why is it essential that the initialization be performed by the module ctor
rather than the first function called by main()?
I can understand your desire from a stylistic POV but not from a purely
run-time operational POV.
--
Derek
(skype: derek.j.parnell)
Melbourne, Australia
"Down with mediocracy!"
17/05/2006 10:10:06 AM
More information about the Digitalmars-d
mailing list