Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Merging Main() Functions

Options
  • 13-11-2010 2:51pm
    #1
    Closed Accounts Posts: 214 ✭✭


    I'm having a problem at the moment where i need to merge a physics engine and Direct3D window into one Visual Studio C++ Project.
    The problem is that both have their own specific main() calls:

    The physics engine uses the usual int main(int argc, const char** argv),

    and Direct3D uses the Windows program call int WINAPI WinMain(HINSTANCE hInstance,
    HINSTANCE hPrevInstance,
    LPSTR lpCmdLine,
    int nCmdShow)

    Is it possible to get both running from one universal main() so the physics Console and the D3D Window are displayed?


Comments

  • Registered Users Posts: 981 ✭✭✭fasty


    Sure it's possible but you really aren't giving enough info. And unless the actual code for at least the physics engine is in a static or dynamic library, you'll have to make one yourself or merge code from one project into another.


  • Closed Accounts Posts: 214 ✭✭Assmaster_Kronk


    fasty wrote: »
    Sure it's possible but you really aren't giving enough info. And unless the actual code for at least the physics engine is in a static or dynamic library, you'll have to make one yourself or merge code from one project into another.

    Neither of them are static libraries, at the moment they're both in one project, but won't run simultaneously due to their separate main() calls.
    The way i've seen it done before was having the core parts as classes which are then initialized in a single main() function, but i'm not sure if this is the right way to go?


  • Registered Users Posts: 981 ✭✭✭fasty


    Fair enough. What you're suggesting is one way of doing it. I mean the main function is the entry point for a program, so there's only going to be one and it'll kick off everything.


Advertisement