Project

General

Profile

Pass additional parameter to WTHomepage application

Added by Jason Lamar about 15 years ago

Hey,

In the wtHomepage example, a call is made to

int main()
{
  ..stuff...
    server.addEntryPoint(Application, createWtHomePageApplication, "", "/css/wt/favicon.ico");

   ...stuff...
   return 0;
}

From what I can tell, that calls a function in WtHome.cpp:

WApplication *createWtHomeApplication(const WEnvironment& env)
{
   ... do stuff
   return new WtHome(env);
}

which then creates a new instance of WtHome and passes parameters to Home.

How can I pass an additional parameter to createWtHomePageApplication so I can then pass it to the Home class?

Thanks!


Replies (2)

RE: Pass additional parameter to WTHomepage application - Added by Jason Lamar about 15 years ago

Ideally, I would just like to be able to pass a pointer, which is instantiated in my main(), from main to my Home.cpp class. I tried making a static variable in my main, but for some reason I couldn't see it from my Home class (unless I did it wrong).

RE: Pass additional parameter to WTHomepage application - Added by Jason Lamar about 15 years ago

I just used a static variable, got it to work. Thanks!

    (1-2/2)