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 7915055
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T14:19:50+00:00 2026-06-03T14:19:50+00:00

in my Windows C++ program I have a few dependencies on DLLs (coming with

  • 0

in my Windows C++ program I have a few dependencies on DLLs (coming with drivers of input devices). I don’t actually load the DLLs myself, but the drivers provide (small) .lib library that I statically link against (and I assume it is those libraries that make sure the DLLs are present in the system and loads them). I’m writing an application that can take input from a series of video cameras. At run-time, the user chooses which one to use. Currently my problem is that my routines that query whether a camera is connected already require the functionality of the camera being present on the system. I.e. let’s say there is camera model A and B, the user has to install the drivers for A and B, even if he knows he just owns model B. The user has to do this, as otherwise my program won’t even start (then when it started it will of course tell the user which of the two cameras are actually connected).

I’d like to know whether there is any possibility, at run-time, to determine which of the DLLs are present, and for those that aren’t, somehow disable loading even the static (and, thus, dynamic) component.

So basically my problem is that you cannot do if(DLL was found){ #include "source that includes header using functions defined in lib which loads DLL"}

  • 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-03T14:19:51+00:00Added an answer on June 3, 2026 at 2:19 pm

    I think using the DELAYLOAD linker flag may provide the functionality required. It would allow linking with the .lib files but would only attempt to load the DLL if it is used:

    link.exe … /DELAYLOAD:cameraA.dll /DELAYLOAD:cameraB.dll Delayimp.lib

    The code would be structured something similar to:

    if (/* user selected A */)
    {
        // Use camera A functions, resulting in load of cameraA's DLL.
    }
    else
    {
        // Use camera B functions, resulting in load of cameraB's DLL.
    }
    

    From Linker Support for Delay-Loaded DLLs
    :

    Beginning with Visual C++ 6.0, when statically linking with a DLL, the
    linker provides options to delay load the DLL until the program calls
    a function in that DLL.
    
    An application can delay load a DLL using the /DELAYLOAD (Delay Load Import)
    linker option with a helper function (default implementation provided by
    Visual C++). The helper function will load the DLL at run time by calling
    LoadLibrary and GetProcAddress for you.
    
    You should consider delay loading a DLL if: 
    
    - Your program may not call a function in the DLL.
    - A function in the DLL may not get called until late in your program's
     execution.
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a Windows C++ console program, and if I don't call ReleaseDriver() at
I have a program (jhead) that compiles with very few tweaks for both Windows
I have a c++/windows program that receives data from another c++ program via a
I have an owner-drawn list control in my Windows program. I use CListCtrl::GetBkColor to
I have an ASP.NET web service that I can access via a windows program
I have a Windows Mobile program that accesses an attached device through a third-party
I'm stress testing a web app and have set up a windows test program
I'm having problem when running my Windows Forms program. In the program, I have
I have created a program with Windows Forms in C# and the architecture is
I have a program that still must target Windows XP (_WIN32_WINNT 0x501), as most

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.