文章目录
- 如何修复`R6025 pure virtual function call`问题
<2022-04-19 周二>
如何修复R6025 pure virtual function call问题
运气好,修复了这个问题。即,在ExitInstance()函数中调用一下MagickLib::DestroyMagick();即可。
过程中也经历了尝试vs2010编译,尝试更换电脑环境等,均没有找到原因,同时我也在怀疑会不会是IMDisplay.exe这个外部的测试程序问题引起的?毕竟ImageMagick和GraphicsMagick的这个IMDisplay.exe程序相差也是很大的。
同时了解调用OpenCLTerminus()的所有地方,在nt_base.c:DllMain()的DLL_PROCESS_DETACH里面调用DestroyMagick();是不是不好?
case DLL_PROCESS_DETACH:DestroyMagick();break;
另IMDisplay.cpp中只有InitInstance(),却没有ExitInstance(),是不是应该显示调用MagickLib::DestroyMagick();比交给系统处理DLL_PROCESS_DETACH更好呢?
值得注意的是如果将ImageMagick的如下代码修改成这样:
BOOL CIMDisplayApp::ExitInstance()
{// Magick::TerminateMagick();return CWinApp::ExitInstance();
}
同时保证ImageMagick的magick-baseconfig.h中的ProvideDllMain宏启用:
/*When building ImageMagick using DLLs, include a DllMain()function which automatically invokes MagickCoreGenesis(NULL), andMagickCoreTerminus() so that the user doesn't need to. This is disabledby default.
*/
#define ProvideDllMain
则ImageMagick也同样会出现R6025的错误。
见commit:fix R6025 on windows。
