Cannot load dll when deploying



  • I write dbapi.dll myself in eclipse mingw (nothing to do with Qt), in the dll used iconv and winsock functions(static link).

    I can load dbapi.dll during Qt developing, both in debug and release setting. When I want to deploy the release version to another desktop (same win7 system), the dll cannot be loaded. Please advise what is wrong. Maybe I need some extra plugins in the release folder because using iconv, winsock functions?

    Code is like:

    @#ifndef CSHAREDDLL_H
    #define CSHAREDDLL_H

    #include <QLibrary>

    #include "dbapi.h" //the header file of dll

    typedef void (*tagSession)(HANDLE const handle);

    class CSharedDLL
    {
    public:
    tagSession funSession;

    public:
    CSharedDLL();
    bool load();

    private:
    QLibrary dbapi;
    };

    #endif // CSHAREDDLL_H
    @

    @
    #include "cshareddll.h"

    CSharedDLL::CSharedDLL():
    dbapi("dbapi.dll")
    {
    }

    bool CSharedDLL::load()
    {
    if (dbapi.load())
    {
    funSession=(tagSession)dbapi.resolve("runSession");
    return funSession;
    }
    else
    return false;
    }
    @



  • Hi, you could check what DLLs/plugins are actually loaded on your development machine.
    Download for example listdlls.exe from sysinternals.com, start your app and then run listdlls <yourappname> to get a list of all the dlls.



  • I agree with hskoglund - but personally I use Dependency Walker on the deployment machine to see what's broken.



  • Yes Dependency Walker can be useful as well, but it has one great weakness: it does not show the plugins that Qt itself (and not Windows) needs, like qwindows.dll or qwebwiew.dll.

    So if you really want a list of all the dlls that needs to be copied to another PC, you need a better tool than Dependency Walker.



  • @hskoglund I think the last time I used it to diagnose problems with deployment, it was showing me the Qt DLLs I was missing (and in another case I had some libraries expecting Qt 4 DLLs while the deployed project came with the Qt5 versions).

    I might be wrong. But anyway, i'll make sure to try out listdlls.exe when I encounter another problem like that.


  • Moderators

    [quote author="hskoglund" date="1395828859"]Yes Dependency Walker can be useful as well, but it has one great weakness: it does not show the plugins that Qt itself (and not Windows) needs, like qwindows.dll or qwebwiew.dll.[/quote]If you click "Profile" -> "Start Profiling", it will find those plugins.



  • Indeed, qwindows.dll showed up (!) maybe Dependency Walker isn't so bad after all :-)
    (but I still don't like those false warnings, like IESHIMS.DLL missing, that Dependency Walker sometimes shows, or maybe it's just my age showing.)



  • Just solved. I used iconv functions in my dll, however libiconv-2.dll, not iconv.dll need to copy into the release folder. I download Dep walker and found that. Thanks guys.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.