Irritating shortcoming with modules and externs

Jarrett Billingsley kb3ctd2 at yahoo.com
Tue May 16 20:28:56 PDT 2006


"Brad Roberts" <braddr at puremagic.com> wrote in message 
news:Pine.LNX.4.64.0605161842050.2422 at bellevue.puremagic.com...

> How about moving to a delegate model instead of a direct global symbol
> model?  It's much more obvious, imho.

That's probably what I'll end up doing, although the function that I wanted 
to do this with was main (so basically I could "intercept" the call to main 
in my library, and call the user-defined "LibMain" or something to that 
effect).  Of course, seeing that D is an OOP language, I might as well make 
some kind of context class that wraps the entire program, ending you up with 
something like:

abstract class Context
{
...
}

class MyContext : Context
{
    // override all those stubbed-out methods
}

void main(char[][] args)
{
    MyContext c = new MyContext();
    c.main(args);
} 





More information about the Digitalmars-d-learn mailing list