English 中文(简体)
Dll 依赖性版本冲突
原标题:Dll dependency version conflict

我使用C++ 与2008视觉工作室快递。

我们正在向一个客户提供一个二进制的Windows图书馆,客户本身也使用许多其他图书馆。 因此,我们发送了我们的Dll文件以及我们使用的Dll文件。 现在的问题是,我们的客户使用我们也使用的一些图书馆,但使用另一个版本。 因此,他不能使用我们的图书馆,因为我们共同依赖的图书馆是互不兼容的。

从技术上讲,我认为应该有可能将两个依赖版本都装入进程空间。 然而,我不确定如何做到这一点,因为这两个版本的应用以及我们的文件都寻找相同的依赖文件文件名。 谁能告诉我处理这一问题的最佳/最清洁的方法是什么?

谢谢!

最佳回答

一般来说,它不会起作用。 这是因为第三方的 DLL 版本在装入内存时可能会相互干扰。 举例来说, 如果有独家资源, 比如特定目录中的文件, 或者特定设备。 问题是, 很可能没有人知道 第三方 DLL 版本的制造商 —— 因此需要进行广泛的测试 。

但也许你很幸运,不管怎样,它还是管用的。

  1. Put your DLL "DTAG.DLL" and all needed DLLs in a subdirectory of the applications directory with a fixed name e.g. "DTAG_LIB".
  2. Write a import library by hand (there are other possibilities using DELAYLOAD). In that library load your DLL with LoadLibraryEx. Provide an absolute path ending with "DTAG_LIBDTAG.DLL" and the flag LOAD_WITH_ALTERED_SEARCH_PATH. Windows will then load your DTAG.DLL from this directory and all needed DLLs from that directory also. Don t set the PATH to "DTAG_LIB"!
  3. Your customer has to link against your manual import lib.
问题回答

您可以使用一个( 新的) 额外的 DLL 解决这类问题, 您将交付, 这将处理版本冲突( 运行时), 作为一种应用程序与其依赖关系之间的代理 。

另一种选择是使用Windows 前方图书馆机制

转发器是一种方便的方式,可以容纳从一个DLL到另一个DLL的功能

您可以使用几种方式来声明代理人, 例如模块定义 (.def ) 文件 和 < pragma :

#pragma comment(linker, "/export:function=otherdll.function")




相关问题
Undefined reference

I m getting this linker error. I know a way around it, but it s bugging me because another part of the project s linking fine and it s designed almost identically. First, I have namespace LCD. Then I ...

C++ Equivalent of Tidy

Is there an equivalent to tidy for HTML code for C++? I have searched on the internet, but I find nothing but C++ wrappers for tidy, etc... I think the keyword tidy is what has me hung up. I am ...

Template Classes in C++ ... a required skill set?

I m new to C++ and am wondering how much time I should invest in learning how to implement template classes. Are they widely used in industry, or is this something I should move through quickly?

Print possible strings created from a Number

Given a 10 digit Telephone Number, we have to print all possible strings created from that. The mapping of the numbers is the one as exactly on a phone s keypad. i.e. for 1,0-> No Letter for 2->...

typedef ing STL wstring

Why is it when i do the following i get errors when relating to with wchar_t? namespace Foo { typedef std::wstring String; } Now i declare all my strings as Foo::String through out the program, ...

C# Marshal / Pinvoke CBitmap?

I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...

Window iconification status via Xlib

Is it possible to check with the means of pure X11/Xlib only whether the given window is iconified/minimized, and, if it is, how?

热门标签