在发布和调试模式下同时使用Boost
标题只是为了调侃而已。 :-) 我知道这是不可能的,但这是我的问题。
我的应用程序(实际上是一个 DLL)使用 Boost。它还使用外部 API,该 API 也使用 Boost。 当然,外部 API 是在发布二进制文件中提供的,以及所需的发布 Boost 二进制文件。
当我在发布模式下编译/链接 DLL 时,没有问题。我准确地说,我以动态方式将我的应用链接到 Boost (BOOST_ALL_DYN_LINK)。在调试模式下,我无法加载 DLL。 我不确定这是因为 Boost,但我怀疑 Windows 不喜欢使用两个 Boost(发布版本由外部库调用,调试版本由我的代码调用)。
如果我将代码与 Boost 版本静态链接,效果会更好吗?
我不认为这与CRT有关,因为我的事件查看器中没有任何内容。
我使用 Visual Studio 2005 SP1。
谢谢。
The title is just for teasing. :-)
I know it isn't possible, but here is my problem.
My app (a DLL, actually) uses Boost. It also uses an external API, which also uses Boost.
The external API is of course provided in a release binary, anlong the needed release Boost binaries.
When I compile/link my DLL in release mode, I have no problem. I precise I link my app to Boost in a dynamic way (BOOST_ALL_DYN_LINK). In debug mode, I can't load my DLL.
I am not sure it is because of Boost, but I suspect Windows doesn't like working with two Boost (the release one called by the external lib, and the debug one called by my code).
Will it work better if I link my code statically with the release Boost ?
I don't think it is related to CRT, because I have nothing in the Events Viewer.
I use Visual Studio 2005 SP1.
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
是的,这就是我所期望的 - 如果你静态链接,你会在二进制文件中获得一个 boost '副本',并且不会为你自己的 boost 需求加载任何 boost DLL .. 外部库会很高兴地链接到它的发布 dll。但是,如果外部库实际上在您的应用程序调用的公共 API 中使用 boost,则这将不起作用!在这种情况下,你将无法解决问题。如果您调用任何需要 boost 内容的 API,则您的 boost 构建必须与 API 实现的 boost 相匹配。
Yes, that's what I would expect - if you link statically, you get a boost 'copy' in your binary, and no boost DLL is ever loaded for your own boost needs .. the external library will happily link to its release dlls. However, this won't work if the external library actually uses boost in its public API called by your application! In this case, you won't be able to solve the problem. If you call any APIs expecting boost stuff, your boost build must match the boost of the API's implementation.