Results 1 to 9 of 9

Thread: DLL won't load

  1. #1
    Join Date
    May 2009
    Location
    USA
    Posts
    300
    Thanks
    82
    Thanked 11 Times in 11 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default DLL won't load

    I compiled a 3rd party library (developing on Windows) to create the dll.
    To my knowledge it is not dependent on any other dll, since it is built using the static libraries it needs, expat, zlib, and openssl, all of which I compiled to create the .a files. The dll creates with no errors.

    The problem is the dll won't load for my Qt application.
    Here is the code:
    Qt Code:
    1. QLibrary tqsllib2;
    2. tqsllib2.setFileName("c:/cpp/qt_projects/hrlogger_development/debug/tqsllib2.dll");
    3. tqsllib2.load();
    4.  
    5. qDebug() << "is tqsllib2 loaded ? " << tqsllib2.isLoaded();
    6. qDebug() << "lib load error is " << tqsllib2.errorString();
    To copy to clipboard, switch view to plain text mode 
    The debug returns:
    is tqsllib2 loaded ? false
    lib load error is "Cannot load library c:/cpp/qt_projects/hrlogger_development/
    debug/tqsllib2.dll: "

    If I try to load a test dll using the above code, like a small one from the Windows/system32 directory, it loads fine. I realize this is not a Qt issue, but am hoping someone with more experience at this might be able to give me some suggestions as to what is going wrong.

    Edit: If I point the setFileName to the original directory where the dll was created, the error message changes slightly:
    lib load error is "Cannot load library c:/mingw/msys/1.0/home/wayne/tqsllib/tqs
    llib2.dll: The specified module could not be found."
    Last edited by waynew; 24th October 2010 at 21:01.

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: DLL won't load

    Use Dependency Walker on your dll to see its requirements.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. The following user says thank you to wysota for this useful post:

    waynew (24th October 2010)

  4. #3
    Join Date
    May 2009
    Location
    USA
    Posts
    300
    Thanks
    82
    Thanked 11 Times in 11 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: DLL won't load

    Thanks Wysota. It's telling me there are problems with the dll

    Error: At least one module has an unresolved import due to a missing export function in an implicitly dependent module.
    Warning: At least one delay-load dependency module was not found.
    Warning: At least one module has an unresolved import due to a missing export function in a delay-load dependent module.

    I'll go back to the configure/build log and see if I can figure out what is missing.

  5. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: DLL won't load

    You don't have to figure out anything. Dependency Walker has a list of dependencies and marks which ones are unresolved.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  6. #5
    Join Date
    May 2009
    Location
    USA
    Posts
    300
    Thanks
    82
    Thanked 11 Times in 11 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: DLL won't load

    Yep, I found that. Looks like it wants 2 dlls that usually come with Vista, but not XP.
    Got the dlls and building the library again.
    Thanks.

  7. #6
    Join Date
    Oct 2009
    Posts
    364
    Thanks
    10
    Thanked 37 Times in 36 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: DLL won't load

    it depends (no pun intended)... the output from depends needs to be interpreted on a case by case basis. I don't find it that straightforward to use (I like ldd in linux way better) - or I'm just not as bright.

    For example if I run it on my app that runs just fine, it reports two errors and two warnings.
    The two errors are deep down the tree for QTCORE4.dll:
    IESHIMS.dll
    WER.dll
    Those two files can't be found and it is the same two DLLs no matter what executable I try to open.

    The two warnings are:
    At least one delay-load dependency module was not found.
    At least one module has an unresolved import due to a missing export function in a delay-load dependent module.

  8. #7
    Join Date
    May 2009
    Location
    USA
    Posts
    300
    Thanks
    82
    Thanked 11 Times in 11 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: DLL won't load

    Thanks for reporting your experience Schnitzel - those are exactly the dlls Dependency Walker was complaining about.
    Evidently they come with Vista, but not XP.
    So I downloaded them and rebuilt the library. DW reports no missing dlls now, but it still gives me the same 2 errors you mentioned.

    However, the library dll still refuses to load. I also have the application that uses that library installed on my development machine. So I tried loading the library from the application directory and it won't load either.

    Maybe it's just something incompatible between this library and Qt. Not being an experienced C/C++ developer, I am lost now.
    No idea as to how to make this work.

  9. #8
    Join Date
    Oct 2009
    Posts
    364
    Thanks
    10
    Thanked 37 Times in 36 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: DLL won't load

    does the library come with examples?
    do you have the full source?

    why are you even explicitly trying to load the library?
    Simplify your test case, i.e. write a simple app that only uses one method (such as an open or init call) in the dll.

  10. #9
    Join Date
    May 2009
    Location
    USA
    Posts
    300
    Thanks
    82
    Thanked 11 Times in 11 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: DLL won't load

    Unfortunately, no. It comes with a binary application that uses the library and the library.

    Yes.

    Just to make sure it loads ok before I try to use some of the functions in it.

    I haven't even tried using any of the functions in it yet since it won't load.
    It's fairly large, but I only need a few functions. If I can't get this to work, the alternative is to export some data from my app, then have the user open the other app (the one that uses the library), then process the data from there. But it would be much more convenient for the user if they can process the data from my app.

    I just don't understand why the library won't load. Even the version that their app builds when you install it won't load into my Qt app.
    This is very perplexing to me.

Similar Threads

  1. How to load DLL(C/C++) in Qt on Windows?
    By josecarlosmissias in forum Newbie
    Replies: 1
    Last Post: 20th November 2009, 15:52
  2. how do load image
    By yuvaraj.yadav in forum Qt Programming
    Replies: 5
    Last Post: 21st April 2009, 05:31
  3. Unable to load jpg on Mac OS
    By sgmurphy19 in forum Qt Programming
    Replies: 14
    Last Post: 31st January 2008, 12:49
  4. More CPU Load when using SetText
    By arunvv in forum Newbie
    Replies: 3
    Last Post: 23rd January 2008, 19:35
  5. Qt4 does not load JPG's.
    By Teuniz in forum Qt Programming
    Replies: 3
    Last Post: 3rd September 2007, 23:06

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.