Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Load dll Library
Hello after building a DLL library with visual studio, I linked the DLL in my QT project but it not working
this my code
QLibrary myLib("DLLSUM.dll"); myLib.load(); typedef int(*FNPTR)(int a, int b); FNPTR pSum = (FNPTR) myLib.resolve("sum"); if (pSum) qDebug() << "sum = " << pSum(5,2); else qDebug("DLLSUM not Loaded");
JonB last edited by
And would you care to tell us what your
@JonB qDebug() return this message "DLLSUM not Loaded"
Could you try
if (!myLib.load()) qDebug() << myLib.errorString();
and see what it says ?
@aminemaar Why don't you simply link against this lib instead of loading it dynamically?
Also, you're using a relative path, depending on the current working directory QLibrary will simply not find the lib.