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:
Qt Code:
  1. #include "mainwindow.h"
  2.  
  3. #include <QApplication>
  4. #include <QLibrary>
  5. #include <QDebug>
  6.  
  7. int main(int argc, char *argv[])
  8. {
  9. QApplication a(argc, argv);
  10.  
  11. if (QLibrary::isLibrary("GP_MUC.dll")) {
  12. QLibrary lib("GP_MUC.dll");
  13. lib.load();
  14. if (!lib.isLoaded()) {
  15. qDebug() << lib.errorString();
  16. }
  17.  
  18. if (lib.isLoaded()) {
  19. qDebug() << "success";
  20.  
  21. // Resolves symbol to
  22. // void the_function_name()
  23. typedef int (*FunctionPrototype)();
  24. auto function1 = (FunctionPrototype)lib.resolve("MUX_Version");
  25.  
  26.  
  27. // if null means the symbol was not loaded
  28. if (function1) function1();
  29. }
  30. }
  31.  
  32. MainWindow w;
  33. w.show();
  34. return a.exec();
  35. }
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