locked
Windows Universal Application and Static library linking: Having the main entry point in the static library. RRS feed

  • Question

  • Hello,

    I am porting a old application to new windows universal application (Windows phone and metro style windows app). In my old code structure I have an application and a core library. The core library has the the main entry point which initialize the application and windowing system. The application has a application class that in inherited from application base class (which is in core library).

    I am trying to create similar structure while putting the new universal application code, keeping the 

    [Platform::MTAThread]
    int main(Platform::Array<Platform::String^>^)

    {

    }

    in the static library.

    However, I am getting following two linking errors:

    error LNK2005: "int __abi___threading_model" (?__abi___threading_model@@3HA) already defined in vccorlibd.lib(tmdefault.obj)

    fatal error LNK1169: one or more multiply defined symbols found

    I tried to search in the forum, but it looks like there are only one relevant and which was not clear to me!

    Now can anyone suggest any stable procedure by which I can have this kind of code structure in place?

    Here goes my current code structure:

    CoreLib

    |- BaseApplication

    |- Application::BaseApplication

    |-Main.cpp (This file has the entry point)

    Application

    |- MyApplication::Application

    Thanks in advance.

    Monday, February 2, 2015 7:50 AM

Answers

  • Hi,

    According to your description, you want to make a core library which can initialize the application and as the library as app‘s entry point. But as far as I know, when you create a windows store app or windows phone app, the default entry point is  the App object in App.xaml.cs. You can see in the AppxManifest:

    I think you cannot start application by a core library with the main method. In windows phone and windows store app, you cannot get directly to the Main function, but you can interact indirectly with it through the overrides in the app.xaml.cs (application launching, deactivated, activated etc methods).

    Best Wishes!


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place. <br/> Click <a href="http://support.microsoft.com/common/survey.aspx?showpage=1&scid=sw%3Ben%3B3559&theme=tech"> HERE</a> to participate the survey.

    • Proposed as answer by Anne Jing Friday, February 13, 2015 7:42 AM
    • Marked as answer by Jamles HezModerator Thursday, February 19, 2015 7:59 AM
    Tuesday, February 3, 2015 6:52 AM