Unsolved 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");
-
@aminemaar
And would you care to tell us what yourqDebug()
output...? -
@JonB qDebug() return this message "DLLSUM not Loaded"
-
Hi
Could you tryif (!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. -