Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Buffer Overrun using QLibrary!!!!
Forum Updated to NodeBB v4.3 + New Features

Buffer Overrun using QLibrary!!!!

Scheduled Pinned Locked Moved General and Desktop
3 Posts 3 Posters 3.0k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • F Offline
    F Offline
    feedmeqt
    wrote on last edited by
    #1

    Setup:
    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)
    {
    return 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:

    #include <QLibrary>
    #include <QString>
    #include <qdebug.h>

    //Function Pointers
    typedef QString (*Data)(QString);

    int main(int argc, char *argv[])
    {
    QCoreApplication a(argc, argv);
    bool bLoaded = false;
    //Load win32 Export Library
    QLibrary lib("Temp.dll");
    bLoaded = lib.load();
    Data data= (Data) lib.resolve("Data");
    if(bLoaded)
    {
    for(int i = 0;i<100; i++)
    {
    QString strstring = "Test";
    if(lib.isLoaded())
    QString strReturnVal = data(strstring);
    }
    }
    else
    {
    QString str = "Failed to load Temp library";
    }
    bool bUnLoad = lib.unload();

        return a.exec&#40;&#41;; 
    

    } @

    1 Reply Last reply
    0
    • L Offline
      L Offline
      lgeyer
      wrote on last edited by
      #2

      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.

      1 Reply Last reply
      0
      • G Offline
        G Offline
        goetz
        wrote on last edited by
        #3

        Closed. See Lukas link for the thread to continue in.

        http://www.catb.org/~esr/faqs/smart-questions.html

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved