Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7795387
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T23:03:37+00:00 2026-06-01T23:03:37+00:00

Is delayed DLL loading possible in QT? For example, my program has dependency from

  • 0

Is delayed DLL loading possible in QT?
For example, my program has dependency from some third-party DLL and I want to remove it.

What should I write in .pro file to remove dependency?

Can I store DLL in resources?

Can I load DLL “globally”? So some function from DLL (for example func1) will remain func1 in my code.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T23:03:38+00:00Added an answer on June 1, 2026 at 11:03 pm

    Yes, you want to use the QLibrary class. It is specifically provided to load shared libraries at runtime.

    In this case you do not need anything in your .pro file. However, you need to make sure the DLL is available on the target computers. It either needs to be in a location where the system can find it (PATH on Windows, LD_LIBRARY_PATH on Linux, DYLD_LIBRARY_PATH on Mac) or you can provide an absolute path from your application.

    If you look at the documentation you will see how to map a library function to a function pointer in your code so that “func1()” will point to the function in your library.

    • QLibrary Class Reference

    [EDIT]

    Here is a proof-of-concept to load a dll from a temp file generated from a resource. IMO, this is a Really Bad Idea, but it at least works on my Windows 7 machine. If you want to do something similar, you will have to handle cleaning up the temp file, checking for duplicates, etc.

    foo.cpp, compiled into a shared library

    #include <QtCore/qglobal.h>
    
    extern "C" Q_DECL_EXPORT int foo(int value) {
      return value + 42;
    }
    

    bar.pro, notice no reference to foo library

    SOURCES += main.cpp
    RESOURCES += resources.qrc
    

    main.cpp

    #include <QtCore>
    #include <iostream>
    
    int main(int argc, char **argv) {
      QCoreApplication app(argc, argv);
    
      // Copy resource dll to temporary file.
      QFile::copy(":/lib/Foo.dll", QDir::temp().filePath("Foo.dll"));
    
      // Load the temporary file as a shared library.
      QLibrary foo_lib(QDir::temp().filePath("Foo.dll"));
      typedef int (*FooDelegate)(int);
      FooDelegate foo = (FooDelegate)foo_lib.resolve("foo");
    
      if (foo) {
        std::cout << "foo(13) = " << foo(13) << std::endl;
      }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a method which should be delayed from running for a specified amount
Long-delayed update I'm accepting MUG4N's answer to this question, and I also want to
I'm trying delayed_job now, and have some questions. From the http://github.com/collectiveidea/delayed_job page, I can
Possible Duplicate: Compare using Thread.Sleep and Timer for delayed execution I am considering whether
when building a dll, how to make an dll delayed depend on another dll?
I saw a delayed example in David Pollak's Beginning Scala . I tried to
I want to use delayed signing for my windows mobile compact framework assemblies. When
I want to use Delayed::Job (or perhaps a more appropriate job queue to my
Possible Duplicate: Rails delayed job not working How do I create an background task
I have a delayed job which is working perfectly fine. I want to know

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.