Important: Please read the Qt Code of Conduct -

QLibrary.load freezes application

  • Hey guys,

    I have a problem with one of my applications.
    I'm loading a dll with QLibrary. While I'm in my debug-configuration everything is fine, but as soon as I'm on release QLibrary.load never finishes.
    When I restart my application several times, suddenly it works but only 1 out of 15 trials...

    Any idea what could be the reason for it?
    I'm using the same dll in several applications without problems.


    OS: windows 64bit
    Qt: 5.8.0

  • Lifetime Qt Champion

    @themts Can you show the code where you load the lib?

  • bool LoadAHEDnetLib(QString pathAHEDnetLib = "") {
        QFile file(pathAHEDnetLib);
        if ((pathAHEDnetLib == "") || (!file.exists())){
            _ahedLib = new QLibrary("libAHEDnet.dll");
        } else
            _ahedLib = new QLibrary(pathAHEDnetLib);
        qDebug() << "Load AHEDnet.dll";   
        if ((_ahedLib == NULL) || !_ahedLib->load())  <<<THIS IS THE LINE WHERE IT FREEZES
            return false;     <<<< THIS LINE IS NEVER REACHED
        qDebug() << "Load AHEDnet.dll DONE";  <<<< THIS LINE IS NEVER REACHED

    Quite simple...
    It's not returning failed or anything, it's just dead-locked.

  • Lifetime Qt Champion

    @themts Did you try to load any other lib? Just to see whether it is related to one specific lib.

Log in to reply