With "install as shared DLLs" I mean that runtime libraries (eg. Visual C++, VB) get an entry in the registry:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\SharedDLLs
There a DLL's reference count gets increased when an application also uses that DLL. If that application will be uninstalled, the DLLs reference count gets decreased. If a DLL's reference count reaches 0, the DLL can be deleted.
That seems to be the "clean way", but I'm not sure.
Thanks! :)