QProcess and custom static-linking dlls location



  • Hello!

    Let's assume we have Host process and Plugin process (yeah separate process plugin o_O), which are E:/program/host.exe and E:/program/plugins/plugin.exe. Whatever it takes, user launches host.exe, which looks at ./plugins for plugin.exe, then comes the code, simplified:
    @QProcess *possiblePlugin = new QProcess(0);
    possiblePlugin->start(pluginsPath+"/plugin.exe");@

    However, I have some few dll libraries in E:/program (say E:/program/util.dll) and I want them to be available for plugin.exe to link statically. I specifically don't want to have plugin.exe in E:/program folder as well as to have a copy of all dlls in E:/program/plugins. I also tried code like this before calling start():

    @QProcessEnvironment pe = QProcessEnvironment::systemEnvironment();

    QString envPath = pe.value("PATH", "");
    pe.remove("PATH");

    if(!envPath.isEmpty())
    envPath.append(';');
    envPath.append(QCoreApplication::applicationDirPath());

    pe.insert("PATH", envPath);

    QStringList envList = pe.toStringList();
    possiblePlugin->setEnvironment(envList);@

    But this doesn't have any effect.
    By the way running with QProcess seems to resolve Qt-dependencies, while clicking in explorer results in "QtCore4.dll not found", since I don't have any in my E:/program/plugin folder. Hence I run host.exe with Qt Creator's Run button. This gives me an idea, that my goal is to apply just one more path where dlls to be found, because program already looks at C:/QtSDK/... for Qt's dlls (so why mine are worse?).
    May be I look in wrong place or do something wrong, but I believe this is possible. So how do I add my path for a child process, any suggestions?


Log in to reply
 

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