Results 1 to 3 of 3

Thread: QLibrary load inside class

  1. #1
    Join Date
    Jan 2006
    Location
    Sta. Eugènia de Berga (Vic - Barcelona - Spain)
    Posts
    869
    Thanks
    70
    Thanked 59 Times in 57 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default QLibrary load inside class

    Hi,

    I'm trying to load a library in runtime using QLibrary.
    I'm using the QLibrary class inside a class. I'm able to call a resolved function from the library. The problem is on the next function,method, ... call. This call produces a "buffer saturation" error. If I load the library into the main it works perfectly.
    I want to use the QLibrary inside a class because it will be like a plugin.

    Is there any memory limitation or maybe I'm making a mistake?

    Here there is the piece of code in the application constructor:
    Qt Code:
    1. QLibrary myLib("pci-dask");
    2. typedef I16 (*MyPrototype)(U16,U16);
    3. MyPrototype myFunction = (MyPrototype) myLib.resolve("Register_Card");
    4. myFunction = (MyPrototype) myLib.resolve("Register_Card");
    5. if (myFunction)
    6. card = myFunction(PCI_7230,card_number);
    7.  
    8. m_qDAQThread.setCard(card); //This cause the crash. Changing it to any call like a "QObject::connect" produces the same error
    To copy to clipboard, switch view to plain text mode 

    If I don't call "card = myFunction(PCI_7230,card_number)", there is no problem.

    Thanks,

    P.S.: I'm using Qt 4.6.1 and Visual Studio 2008 on Windows XP
    Last edited by ^NyAw^; 13th February 2012 at 15:42.
    Òscar Llarch i Galán

  2. #2
    Join Date
    Jan 2006
    Location
    Sta. Eugènia de Berga (Vic - Barcelona - Spain)
    Posts
    869
    Thanks
    70
    Thanked 59 Times in 57 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: QLibrary load inside class

    Hi,

    Has no one found a similar problem?

    Thanks,
    Òscar Llarch i Galán

  3. #3
    Join Date
    Jan 2006
    Location
    Sta. Eugènia de Berga (Vic - Barcelona - Spain)
    Posts
    869
    Thanks
    70
    Thanked 59 Times in 57 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: QLibrary load inside class

    Hi,

    There is an option in Visual Studio "/GS" that if I disable it then I get a "0xC0000005" error.
    The problem is that I there is no crash if I don't call any resolved fucntion.
    Qt Code:
    1. m_qLibrary.setFileName("pci-dask");
    2. if (m_qLibrary.load())
    3. {
    4. //Pointer to functions
    5. Register_Card = (pf_Register_Card) m_qLibrary.resolve("Register_Card");
    6. Release_Card = (pf_Release_Card) m_qLibrary.resolve("Release_Card");
    7. DI_ReadPort = (pf_DI_ReadPort) m_qLibrary.resolve("DI_ReadPort");
    8. if (Register_Card)
    9. m_card = Register_Card(PCI_7230,card_number);
    10.  
    11. QObject::connect(this,SIGNAL(mySignal()),this,SLOT(mySlot())); //This produces the error
    12.  
    13. if (DI_ReadPort)
    14. I16 error = DI_ReadPort(m_card,0,&m_uInputs);
    15. }
    To copy to clipboard, switch view to plain text mode 
    This produces the error: Excepción no controlada en 0x671d4836 (QtCored4.dll) en ADLINK_IO.exe: 0xC0000005: Infracción de acceso al leer la ubicación 0x6f6c7331.
    That will be like "Exception not controlled in 0x671d4836 (QtCored4.dll) in ADLINK_IO.exe: 0xC0000005: error on reading 0x6f6c7331."

    Thanks,
    Òscar Llarch i Galán

Similar Threads

  1. QLibrary::load: The specified module could not be found
    By mentalmushroom in forum Qt Programming
    Replies: 5
    Last Post: 13th November 2013, 16:32
  2. Replies: 2
    Last Post: 1st February 2011, 21:52
  3. load table inside constructor
    By sattu in forum Qt Programming
    Replies: 0
    Last Post: 10th January 2011, 10:09
  4. [SOLVED] Q_ENUMS from another class inside a plugin
    By desch in forum Qt Programming
    Replies: 1
    Last Post: 1st December 2007, 15:44
  5. Replies: 4
    Last Post: 7th March 2006, 08:52

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.