使用硬链接加载 DLL
我正在尝试设计一种方法,帮助从各种产品的公共位置加载 DLL。这有助于以下目录结构避免文件复制。
INSTALLDIR/Product1/bin
INNSTALLDIR/Product2/bin
..
INNSTALLDIR/ProductN/bin>
我可以在 INSTALLDIR 中创建一个 DLL 存储库/目录 - 'DLLrepo',并从其中加载所有产品可执行文件,而不是在上面每个产品的 bin 目录中复制 DLL。我正在考虑通过在每个产品的 bin 目录中的“DLLrepo”中创建到每个 DLL 的硬链接来实现此目的。这将有助于解决从 WinXP 开始的平台。使用“探测”方法只能解决Windows Server 2008及以上版本。
如果这种方法看起来是一个合理的解决方案,我想听听您的意见。
当我们创建到文件的硬链接时,资源管理器或 DIR 命令不会考虑涉及链接的文件夹的有效大小。它占目录总大小中链接文件中的实际数据大小。如果我没记错的话,这是 Windows 中的一个已知问题。是否有任何实用程序可用于验证实际文件夹大小?是否可以在目录路径上使用“chkdisk”?我想知道的另一件事是获取在文件数据上创建的链接列表。
I am trying to devise a method which helps to load DLL from a common location for various products. This helps the following directory structure to avoid file replication.
INNSTALLDIR/Product1/bin
INNSTALLDIR/Product2/bin
..
INNSTALLDIR/ProductN/bin>
Instead of replicating DLLs in each product's bin directory above, I can create a DLL repository/directory - 'DLLrepo' in INSTALLDIR and make all product exceutables load from it. I am thinking to do this by creating hardlink to each DLL in 'DLLrepo' in each product's bin directory. This will help to address platforms starting from WinXP. Using 'probing' method can address only Windows server 2008 and above.
I like to get your opinion if this approach looks like a reasonable solution.
When we create hardlink to a file, the explorer or DIR command doesn't account valid size of the folder involving link. It account the actual data size in the linked file in total size of the directory. This is a known issue in windows if I am not wrong. Is there any utility that I can use to verify the actual folder size? Is it possible to use 'chkdisk' on a directory path? Another thing which I like to know is to get the list of links created on file data.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我可以为问题的这一部分提供某种答案。当您创建文件硬链接时,实际上并没有任何“文件”是原始文件的概念。它们中的每一个都指向数据占用的磁盘空间,并且通过任何这些引用修改文件都会影响通过任何其他硬链接访问它时看到的数据。因此,它不是一个已知的“问题”,而是“这就是它的工作原理”。
因此,除非您查看包含链接的文件夹的最高公共父文件夹的大小,否则无法验证“实际文件夹大小”。此时,您可以开始对每个硬链接进行单一计数,以准确了解磁盘上使用的空间。
I can provide an answer, of sorts, for this part of the question. When you create file hardlinks, there's not really any concept of which "file" is the original. Each of them points to the space on disk that the data is occupying and modifying the file via any of these references affects the data that's seen when accessing it via any other hardlink. As such it's less a known "issue" and more of a "this is how it works".
As such, there's no way to verify "actual folder size" unless you're looking at the size of the highest common parent folder of the folders that contain the links. At that point you can start single-counting each hard-link to get an accurate idea of space used on disk.