Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

trying to open .so with QLibrary



  • hello,
    i'm trying to open a .so (i made it in c++) with QLibrary, i've been trying many option but nothing seems to work
    here is my class witch use QLibrary

    .cpp

    UpdateWindows::UpdateWindows()
    {
        ruleName = new QLineEdit;
        statement = new QLineEdit;
        value = new QLineEdit;
        updateButton = new QPushButton("Update Rule");
    
        QObject::connect(updateButton, SIGNAL(clicked()), this, SLOT(update()));
    
        layout = new QFormLayout;
        layout->addRow("Rule Name", ruleName);
        layout->addRow("Statement", statement);
        layout->addRow("Value", value);
        layout->addWidget(updateButton);
    
        this->setLayout(layout);
    }
    
    void UpdateWindows::update(){
        QLibrary myLib("libWESTGARD-SSM") ;
        typedef EUpdateResult (*MyPrototype)(bool);
            MyPrototype resultUpdate =(MyPrototype) myLib.resolve("updateEvaluateParameterizableRulesIf1_2sSucceed");
            if(resultUpdate){
                EUpdateResult Eur = resultUpdate(false);
                if(Eur == UPDATE_OK){
                    QMessageBox msgBox;
                    msgBox.setText("Eur update ok");
                    msgBox.exec();
                }
            }else{
                QMessageBox msgBox;
                msgBox.setText("fonction failed");
                msgBox.exec();
            }
    }
    

    i also tried to add a library inside the .pro

    QT += widgets
    
    
    SOURCES += \
        main.cpp \
        mainwindows.cpp \
        evaluationwindows.cpp \
        updatewindows.cpp \
        configwindows.cpp
    
    HEADERS += \
        mainwindows.h \
        evaluationwindows.h \
        EUpdateResult.h \
        updatewindows.h \
        configwindows.h
    
    win32:CONFIG(release, debug|release): LIBS += -L$$PWD/Westgard-SSM/lib/release/ -lWESTGARD-SSM
    else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/Westgard-SSM/lib/debug/ -lWESTGARD-SSM
    else:unix: LIBS += -L$$PWD/Westgard-SSM/lib/ -lWESTGARD-SSM
    
    INCLUDEPATH += $$PWD/Westgard-SSM/lib
    DEPENDPATH += $$PWD/Westgard-SSM/lib
    
    

    but doesn't work as well


  • Lifetime Qt Champion

    Hi and welcome to devnet,

    Are you sure you library can be found ?

    What version of Qt are you using ?
    On what platform ?


Log in to reply