Page 1 of 1

Release mode crash @Win/MFC

Posted: 2011-03-09T12:00:12-07:00
by Kane
Hi there,

I am using ImageMagick-6.6.3-Q16 under Win7 working with Visual Studio 2010 on a C++ standard MFC application. It is needed as small tool in a larger solution to resize and crop images. After reading the HowTos and some threads in this forum I was able to get it working in debug mode.

So far I added the installation and ./include folder as additional include directories and ./lib as additional library directory. I linked CORE_RL_magick_.lib, CORE_RL_Magick++_.lib,CORE_RL_wand_.lib and X11.lib. Furthermore I copied all necessary dlls into my applications folder.

The debug version using MFC in a shared dll works just fine although I'm obviously using IM release builds. Here's the code:

Code: Select all

CString oPath;
// Path detection part removed...

Magick::Image oImage;
oImage.read(LPCTSTR(oPath));

unsigned int nXPixels;
unsigned int nYPixels;
nXPixels = oImage.columns();
nYPixels = oImage.rows();    
oImage.crop(Geometry(nXPixels - (m_nCropRight * (nXPixels / 200)) + 1,
                    nYPixels - (m_nCropBottom * (nXPixels / 200)) + 1));
oImage.chop(Geometry(m_nCropLeft * (nXPixels / 200) + 1,
                    m_nCropTop * (nXPixels / 200) + 1));
    
oImage.write(LPCTSTR(oPath));
Now when switching my app to release version "oImage.read(LPCTSTR(oPath));" makes the running instance crash. When using standard windows libraries for MFC (as i usual do) it only tells me about a "fatal error" in my app at this line. When using shared dll (like in debug mode) I get "Magick::ErrorMissingDelegate at memory location". Includes, directories and dependecies are the same as in debug mode.

I really spend much time googling and searching this forum, carrying this problem with me for about six month now and I still got no idea how to make my app work with IM in release mode.

Thanks for any help in advice.