Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
342 views
in Technique[技术] by (71.8m points)

c++ - Load multiple copies of dll in same process

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.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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 :)

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...