在同一进程中加载dll的多个副本 [英] Load multiple copies of dll in same process
本文介绍了在同一进程中加载dll的多个副本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个由第三方生成的dll,它有某种内部数据结构,将其大小限制为X个元素。
基本上,它有一个Queue X为限制。
现在从我已知的DLL的每个进程,但是可以不止一次加载DLL?也许每个线程?在C#中?或在C ++ / CLI?
我正在尝试加载本机c ++ dll。
解决方案
不幸的是,NT核心 DLL加载程序不会公开公共接口来跳过已经加载的DLL的池。因此,您只剩下几个选择:
- 复制,硬链接,符号链接和/
- 使用多个进程,并且每个进程加载一个DLL。
- 编写一个新的DLL加载器
- 确认DLL的供应商修复它(可能比编写DLL加载器更难)
I have a dll produced by a third party that has some sort of internal datastructure that limits it's size to X elements.
So basically, it has a Queue with X as the limit.
Now from what I've known DLL's are per process, but is it possible to load a DLL more than once? Maybe per thread? In C#? or in C++/CLI?
I'm trying to load a native c++ dll.
解决方案Unfortunately, the NT core DLL loader routines don't expose a public interface to skip the pool of already-loaded DLLs. As such, you're left with just a few choices:
- Copy, hardlink, symlink, and/or use reparse points to fool the loader into thinking you have multiple distinct DLLs.
- Use multiple processes, and load one DLL per process.
- Write a new DLL loader (very much not for the faint of heart!)
- Convince the DLL's vendor to fix it (likely to be harder than writing a DLL loader :)
这篇关于在同一进程中加载dll的多个副本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文