1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Can a COM DLL be statically linked with an EXE?

Discussion in 'C' started by snlabc, Nov 25, 2010.

  1. snlabc

    snlabc New Member

    Nov 19, 2010
    Likes Received:
    Trophy Points:
    I have an EXE application that uses a COM DLL. Say App.EXE and COMComponent.DLL.
    Usually whenever there is a change in the COM DLL I send the new COM DLL and EXE to the client and ask to register the COM DLL manually.
    Now I am thinking of a way to send only the EXE with the DLL bundled with it so that client does not have to do any manual registration and but the EXE will use the latest COM DLL.
    Is there any way that the COM component be bundled with EXE (like statically linking), so that the user need not
    specifically update the component manually?
    Or do I need to change the COM DLL to normal DLL and link statically with it?
    Hope I could describe my problem clearly.
  2. xpi0t0s

    xpi0t0s Mentor

    Aug 6, 2004
    Likes Received:
    Trophy Points:
    Senior Support Engineer
    No, and you wouldn't want to. COM relies on dynamic linking. If you don't want that, then rewrite the DLL as a static library (not DLL, because a Dynamic Linked Library is, as might be inferred from the name, Dynamically Not Statically Linked) and statically link it with the program.

    But it sounds like you are trying to solve a different problem. Why would you want to link a com component statically with the application anyway? If it's just to stop the need to ask the client to register the DLL manually, then just create an installer that can handle new installations and updates. It's much nicer for the customer just to double-click an EXE and have it do everything. Arguably, if what the customer needs to do can be described, then it can be programmed into an installer.

Share This Page