Buffer Overrun using QLibrary!!!!
QT 4.7.4 , MSVC2010 (IDE)
Step 1: I have created a win32 dll with name Temp.dll in which i have linked QT libraries & also added required include files so that i can also use QT datatypes in that dll.
In Temp.dll I have exported a class & the class has one function with following prototype & definition
QString Data(QString data)
Step 2: Now I have created one Sample QT Appplication code for same is given below but when I am trying to call the above function in this application in for loop after 2-3 iterations of for loop it is crashing & giving following error message
A buffer overrun has occurred in LoadLibrary.exe which has corrupted the program's internal state. Press Break to debug the program or Continue to terminate the program.
For more details please see Help topic 'How to debug Buffer Overrun Issues'.
@Sample App Code:
typedef QString (*Data)(QString);
int main(int argc, char *argv)
QCoreApplication a(argc, argv);
bool bLoaded = false;
//Load win32 Export Library
bLoaded = lib.load();
Data data= (Data) lib.resolve("Data");
for(int i = 0;i<100; i++)
QString strstring = "Test";
QString strReturnVal = data(strstring);
QString str = "Failed to load Temp library";
bool bUnLoad = lib.unload();
This is the third thread now. Please stick to the "thread":http://developer.qt.nokia.com/forums/viewthread/13631/ "you" have already created on this topic.
Closed. See Lukas link for the thread to continue in.