vslavik / winsparkle

App update framework for Windows, inspired by Sparkle for macOS
http://winsparkle.org
Other
1.31k stars 267 forks source link

Cannot build as static link in an existing application #211

Closed deanis74 closed 4 years ago

deanis74 commented 4 years ago

In winsparkle.h I have to change:

    #ifdef BUILDING_WIN_SPARKLE
        #define WIN_SPARKLE_API __declspec(dllexport)
    #else
        #define WIN_SPARKLE_API __declspec(dllexport)
    #endif

to:

    #else
        #define WIN_SPARKLE_API
    #endif

After that I can link statically.

vslavik commented 4 years ago

The MSVC solution doesn’t have any static target for a reason: it is not supported. WinSparkle is a DLL by design.

Filing an issue that you cannot do something that you’re not meant to do is weird.

deanis74 commented 4 years ago

In this case, you will probably want to remove this code and comment from UI::Run():

    if ( !ms_hInstance )
    {
        // If DllMain() was not called, assume we're statically linked
        // and use the hInstance of the containing program.
        ms_hInstance = GetModuleHandle(NULL);
    }