Results 1 to 12 of 12

Thread: Problem loading external dll

  1. #1
    Join Date
    Jun 2012
    Posts
    5
    Qt products
    Qt3 Qt4
    Platforms
    Windows

    Default Problem loading external dll

    I create a clr project using some external dlls which are .net based and don't have lib file with it.

    my clr project build result is put in myproject\bin64, while the external dlls are put in myproject\extensions.

    I use QCoreApplication::addLibraryPath("myproject\extens ions") to set the external dll path, I checked with QCoreApplication::libraryPaths() that the correct absolute path is added.

    but when running my application, exception is thrown saying the external dll file is not founded.

    but if I copy the external dll to myproject\bin64, then it works fine. but to keep the project folders neat and well structured, I don't want to put everything in bin64 folder.

    any hint about it?

    thanks and regards,
    WY

  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: Problem loading external dll

    DLLs are loaded before the application is executed thus before any of your code is executed thus before addLibraryPath() is executed. This call is meant to do something different than you expect. Follow your platform guidelines for deploying dll files with your application.
    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. #3
    Join Date
    Jun 2012
    Posts
    5
    Qt products
    Qt3 Qt4
    Platforms
    Windows

    Default Re: Problem loading external dll

    Can you simply suggest what the guideline for deploying external dll in window 7 is? Does that mean I have to put the external dll in my project output folder?

  4. #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: Problem loading external dll

    There are different approaches available. Putting the libraries in the same directory as the application binary is one of them, probably the most common one.
    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.


  5. #5
    Join Date
    Jun 2012
    Posts
    5
    Qt products
    Qt3 Qt4
    Platforms
    Windows

    Default Re: Problem loading external dll

    Quote Originally Posted by wysota View Post
    There are different approaches available. Putting the libraries in the same directory as the application binary is one of them, probably the most common one.
    my question is exactly "what those other approach are". As I said I don;t want to put all of them into bin folder.

  6. #6
    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: Problem loading external dll

    Quote Originally Posted by wangyingmm View Post
    my question is exactly "what those other approach are". As I said I don;t want to put all of them into bin folder.
    As I said, google it or look in msdn. This is nothing related to Qt. What's the point of me repeating what has already been written numerous times all over the internet? What you find will probably explain the situation better and will be more suited to your particular usecase.
    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.


  7. #7
    Join Date
    Jun 2012
    Posts
    5
    Qt products
    Qt3 Qt4
    Platforms
    Windows

    Thumbs down Re: Problem loading external dll

    Quote Originally Posted by wysota View Post
    As I said, google it or look in msdn. This is nothing related to Qt. What's the point of me repeating what has already been written numerous times all over the internet? What you find will probably explain the situation better and will be more suited to your particular usecase.
    then why don't just say you don't know neither. putting useless answer here is also a wasting of time!

  8. #8
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Problem loading external dll

    then why don't just say you don't know neither. putting useless answer here is also a wasting of time!
    @angyingmm:
    If you look at wysotas stats (right corner of any of his posts header) you will see he has about 26500 posts (at time of writing this post).
    More importantly, he has ~3800 Thanked posts!
    I wouldn't, with my 4th!! posts on this forum go and say he "doesn't know" or, that he posts "useless answers".
    However, it is "useless" to post questions which are not Qt related in a Qt Programming forum.
    Moreover, he DID gave you the answer, one you either don't quite understand or too lazy to follow - neither is a reason to slash out.

    Above was meant as a friendly tip.
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

  9. #9
    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: Problem loading external dll

    Quote Originally Posted by wangyingmm View Post
    then why don't just say you don't know neither. putting useless answer here is also a wasting of time!
    There are many approaches available, I'm not a trueseer, I can't see what sits inside your head and which approach is best for you. I told you what to look for, that should be enough. If not, then you can hire me or someone else to look it up for you and implement it for you while you're taking a sunbath at the Carribeans.
    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.


  10. #10
    Join Date
    Jun 2012
    Posts
    5
    Qt products
    Qt3 Qt4
    Platforms
    Windows

    Default Re: Problem loading external dll

    ................


    Added after 4 minutes:


    Quote Originally Posted by high_flyer View Post
    @angyingmm:
    If you look at wysotas stats (right corner of any of his posts header) you will see he has about 26500 posts (at time of writing this post).
    More importantly, he has ~3800 Thanked posts!
    I wouldn't, with my 4th!! posts on this forum go and say he "doesn't know" or, that he posts "useless answers".
    However, it is "useless" to post questions which are not Qt related in a Qt Programming forum.
    Moreover, he DID gave you the answer, one you either don't quite understand or too lazy to follow - neither is a reason to slash out.

    Above was meant as a friendly tip.
    I guess a friendly tip is to give people answer on the thing they need help rather than let them search Google. I do appreciate and admire people here who have knowledge and are willing to share with others. That’s why I come here and ask, but unfortunately met people either can't quite understand the problem, or too lazy to answer. same, neither is a reason to putting the problem out off Qt.

    It IS a QT related question! I DO know how to do it with a normal .net project, but not a Qt project. that's why I ask here.
    Last edited by wangyingmm; 28th June 2012 at 12:39.

  11. #11
    Join Date
    Sep 2011
    Posts
    1,241
    Thanks
    3
    Thanked 127 Times in 126 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Problem loading external dll

    Quote Originally Posted by wysota View Post
    There are many approaches available, I'm not a trueseer, I can't see what sits inside your head and which approach is best for you. I told you what to look for, that should be enough. If not, then you can hire me or someone else to look it up for you and implement it for you while you're taking a sunbath at the Carribeans.
    *like*
    10chars

    Quote Originally Posted by wangyingmm View Post

    I guess a friendly tip is to give people answer on the thing they need help rather than let them search Google. I do appreciate and admire people here who have knowledge and are willing to share with others. That’s why I come here and ask, but unfortunately met people either can't quite understand the problem, or too lazy to answer. same, neither is a reason to putting the problem out off Qt.

    It IS a QT related question! I DO know how to do it with a normal .net project, but not a Qt project. that's why I ask here.

    Your problem is that you used some Qt features wrongly, and thought that the result was a Qt problem. In fact you have a packaging/deployment problem which is not Qt related.
    Last edited by amleto; 28th June 2012 at 12:44.
    If you have a problem, CUT and PASTE your code. Do not retype or simplify it. Give a COMPLETE and COMPILABLE example of your problem. Otherwise we are all guessing the problem from a fabrication where relevant details are often missing.

  12. #12
    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: Problem loading external dll

    Quote Originally Posted by wangyingmm View Post
    It IS a QT related question! I DO know how to do it with a normal .net project, but not a Qt project. that's why I ask here.
    No, it's not related to Qt. Remove all Qt code from your app, take any 3rd party library unavailable by default on the target machine and you'll have the exact same problem. If you know how to solve it there, solve it the same way here. Your problem manifests itself BEFORE the application is executed thus how can it be related to what is INSIDE the application? If you don't believe then remove all code from main(), leave just a simple std::cout << "Hello" << std::endl; and see if it gets printed. If it's not then you should come to a conclusion that whatever you write as code of your program will not help your situation in any way (and thus since not a single line of Qt code was executed, this is not a problem related to Qt).
    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.


Similar Threads

  1. QWebView sometimes not loading external resources
    By complexgeek in forum Qt Programming
    Replies: 2
    Last Post: 6th June 2011, 02:37
  2. DLL loading problem on Mac OSX
    By gib in forum Qt Programming
    Replies: 1
    Last Post: 16th September 2010, 07:24
  3. QML file not loading external JS file?
    By anothertest in forum Qt Programming
    Replies: 2
    Last Post: 14th April 2010, 09:11
  4. External Javascript file not loading initially
    By bkudrle in forum Qt Programming
    Replies: 0
    Last Post: 13th March 2009, 17:05
  5. Problem Loading GIF
    By ScoOteR in forum Newbie
    Replies: 3
    Last Post: 6th June 2007, 10:09

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.