Hi there,

I've recently had reason to depart on a substantially sized foray into the rabbit hole of the inner workings and rules of DLL's and the Component Object Model (COM).

So far I've actually managing to understand most of it, which I'm rather pleased about No doubt I will need to re-read material many times to really cement the knowledge though, but that is a coder's life I suppose.

One thing recently caught my attention though was this on MSDN:

If your application depends on a specific version of a shared DLL, and another application is installed with a newer or older version of that DLL, then that can cause compatibility problems and instability; it can cause your app to start to fail.

The DLL loader looks in the folder that the calling process was loaded from (the executable's folder) before it looks in other file system locations. So one workaround is to install the DLL that your app needs in your executable's folder. That effectively makes the DLL private.

But that doesn't solve the problem for COM. Two incompatible versions of a COM server can be installed and registered (even in different file system locations), but there's only one place to register the COM server. So only the latest registered COM server will be activated.
So two different versions of a DLL can start causing issues if the DLL load procedure should happen to load a version of a DLL that your application cannot use. Most likely because there's two of them lying around and it's chosen what it hopes is the best one but it turns out it isn't. You can negate this by putting your preferred version right in the application directory, and the loader will simply use that one.

However the part in bold confused me a bit. I assume I don't have much say where COM objects are stored and I'm guessing COM objects aren't the sort of thing you can just somehow place in your application folder and hope.

So by a COM server does the documentation essentially mean an actual definition of a COM object rather than just an interface to it?

And if so, is it possible I could have say an application that was written to use an interface say IDXGIFactory for example that works with an old version of the object DXGIFactory but breaks with the new one?

And I've got no control as to where my IDE will go to pick the most suitable version, and possibly a version that causes my application to behave weird or even fail.

(note I'm assuming an object DXGIFactory exists - I'm not actually sure if it does).

Hope that made sense. Thanks in advance for anyone who may reply