Hello,
I would like to link my dll into my QT-Project (dynamic). I am using the QT5.15.2 MinGW 64-bit Kit.
The error, when debugging following code is:
Shared library architecture i386 is not compatible with target architecture i386:x86-64.
"Cannot load library GP_MUC.dll: Unknown error 0x000000c1."
After researching I found out that a i386 architecture means that my dll is a 32 bit dll. And since I am running my project with a 64-bit compiler I am not wondering anymore. But I could just not find a solution on the internet for this. Do I need to run my QT-Project with a 32bit Compiler or is there a chance using this 32 Bit Dll in my 64bit compiled QT-Project.
I am using this code for loading my dll into my project.
main.cpp:
#include "mainwindow.h"
#include <QApplication>
#include <QLibrary>
#include <QDebug>
int main(int argc, char *argv[])
{
if (QLibrary::isLibrary("GP_MUC.dll")) { lib.load();
if (!lib.isLoaded()) {
qDebug() << lib.errorString();
}
if (lib.isLoaded()) {
qDebug() << "success";
// Resolves symbol to
// void the_function_name()
typedef int (*FunctionPrototype)();
auto function1 = (FunctionPrototype)lib.resolve("MUX_Version");
// if null means the symbol was not loaded
if (function1) function1();
}
}
MainWindow w;
w.show();
return a.exec();
}
#include "mainwindow.h"
#include <QApplication>
#include <QLibrary>
#include <QDebug>
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
if (QLibrary::isLibrary("GP_MUC.dll")) {
QLibrary lib("GP_MUC.dll");
lib.load();
if (!lib.isLoaded()) {
qDebug() << lib.errorString();
}
if (lib.isLoaded()) {
qDebug() << "success";
// Resolves symbol to
// void the_function_name()
typedef int (*FunctionPrototype)();
auto function1 = (FunctionPrototype)lib.resolve("MUX_Version");
// if null means the symbol was not loaded
if (function1) function1();
}
}
MainWindow w;
w.show();
return a.exec();
}
To copy to clipboard, switch view to plain text mode
Maybe you can help me with giving me a hint or even giving me an example of how to do it.
Kind regards
Tim
Bookmarks