For example, in language X:
let x = CreateOject( "MyProgID" )
x.LateBoundCall()
x.Release() // (or setting x to Nothing in VB-like language, etc)
What happens to the DLL MyProgID
lives in? Does COM unload DLLs automatically?
This is assuming that the code above is in an executable that does not expose any COM.
Yes, but not in a deterministic way. Windows periodically asks every loaded DLL "is it safe to unload you now?" Any DLL that responds "Yes" is unloaded.
Note a remark from MSDN :
If a DLL loaded through a call to CoGetClassObject fails to export DllCanUnloadNow, the DLL will not be unloaded until the application calls the CoUninitialize function to release the OLE libraries.
See this Old New Thing article.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With