Can a COM DLL be statically linked with an EXE?

snlabc's Avatar, Join Date: Nov 2010
Newbie Member
Scenario:
----------------
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.
0
xpi0t0s's Avatar, Join Date: Aug 2004
Mentor
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.