Hello, everyone.
I need to load a library dynamically (the CapturaECF.dll this in a different directory): "D:\Sweda\lib"
The result is that the library can not be loaded, the message is always shown.
my project file:
--------------------------------------------------
QT -= gui
TARGET = capture
CONFIG += console
CONFIG -= app_bundle
TEMPLATE = app
SOURCES += main.cpp
LIBS += d:/sweda/lib/CapturaECF.lib
--------------------------------------------------
CPP File:
--------------------------------------------------
#include <QtCore/QCoreApplication>
#include <iostream>
#include <QLibrary>
using namespace std;
int main(int argc, char *argv[])
{
QCoreApplication a(argc, argv);
typedef int (*OpenDllPorta)(int porta,int veloc, QString str);
QLibrary library("CapturaECF");
library.load();
bool okLoad = library.load(); // check load DLL file successful or not
bool ok = library.isLoaded(); // check is DLL file loaded or not
if (ok) {
cout << "ok" << endl;
} else {
cout << "not ok" << endl;
cout << library.errorString().toStdString() << " " << library.fileName().toStdString() << endl;
}
return a.exec();
}
--------------------------------------------------
Bookmarks