fftw mingw 预编译二进制文件和 vs 2010 的内存损坏?
我想知道是否有人从未使用与 Visual Studio 2010 项目链接的预编译 mingw fftw 二进制文件遇到过内存损坏问题。奇怪的是,即使没有调用任何 fftw API,仅 fftw libs 链接(由 lib /def:libfftw3-3.def 生成,如 fftw doc 所解释)会给我的项目带来麻烦。 好吧,我将按照作者的建议尝试在 vs 2010 中从头开始编译 fftw,但我很好奇仅仅链接 lib 会导致副作用。据我所知,这似乎不是我们的 C++ 代码的问题...
一些 env.详细信息:win 32 位,vs 2010 中的非托管 c++ 项目
谢谢!
I would like to know if anyone has never experienced memory corruption problems using precompiled mingw fftw binaries linked with visual studio 2010 project. The strange thing is that just the fftw libs linking (generated with lib /def:libfftw3-3.def as explained by fftw doc) brings troubles in my project even if none of fftw API gets invoked.
Well, I'll try compiling fftw from scratch in vs 2010 as the author suggests, but I'm curious about the fact that just linking the lib can cause side effects. As far as I can tell, it does not seem a problem of our c++ code...
Some env. details: win 32 bits, unmanaged c++ project in vs 2010
Thank you!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我不知道 fftw 库是什么,所以我不确定它可能具体做什么来导致不稳定。 DLL 在加载时有可能执行代码,因此您没有主动调用它并不一定意味着它没有执行任何操作。
但是,MinGW 链接到随 Windows 系统分发的
msvcrt.dll
运行时,而在 VS 2010 中使用 DLL 运行时的正常构建将链接到MSVCRT100.DLL
。混合运行时 DLL 是一个可能导致神秘问题的领域,特别是如果从一个运行时进行分配并在另一个运行时释放(或者甚至在另一个运行时使用,我相信如果涉及调试运行时)。您最好的选择可能是尝试使用 VS 2010 重新编译 fftw 库(我假设源代码可用 - 希望使用 MSVC 重建不会太困难)。
可以说服 VS 2010 使用 msvcrt.dll 运行时(微软就是这样做的),但细节并不明显,我的注释在其他地方。
I don't know that the fftw library is, so I'm not sure what it might specifically be doing to cause instability. It's possible for a DLL to execute code when it's loaded, so the fact that you're not actively calling it doesn't necessarily mean it's not doing anything.
However, MinGW links to the
msvcrt.dll
runtime that's distributed with the Windows system, while a normal build using the DLL runtime in VS 2010 will link againstMSVCRT100.DLL
. Mixing runtime DLLs is an area that can cause mysterious problems, in particular if allocations are made from one runtime and freed in another (or even used in another I believe if the debug runtime is involved).Your best bet might be to try to recompile the fftw library with VS 2010 (I assume the source is available - hopefully it's not too difficult to rebuild with MSVC).
It's possible to convince VS 2010 to use the msvcrt.dll runtime (Microsoft does it), but the details are non-obvious and my notes are elsewhere.
fftw 确实做了一些大量的代码生成/分析/CPU 定位;
显然他们在第一次运行时就这样做了。因此,可能存在
抱歉,我不记得具体情况(地点)
fftw does do some hefty code generation/profiling/CPU targeting;
Apparently they do this the first time it's run. So there may be
Sorry I donot remember specifics (locations)