build debug IM, no delegates for BMP, JPG
Posted: 2010-09-14T21:20:58-07:00
I wanted to use IM in my VC8 project.
When I tried to debug my APP, the first thing I noticed was that IM seems to share resource handles or maybe heap pointers between the different run-time libraries, causing a crash in the library code. The only way I know how this might happen is if IM has some code that is built when the APP is built and that code creates or uses resources/pointers also created/used by the IM DLLs (for example, IM might include a preprocessor macro or a C++ template that contains code that creates or uses such handles). Is that correct?
Anyway, moving forward on that theory I got the IM source code so I could build some debug libs that would use the same run-time lib that my APP uses when it is in debug mode, so that things wouldn't crash.
The first thing that happened was 64-bit/32-bit conflict. I need to create 32-bit binaries for distribution (because so many of my customers still use 32-bit OSs), so I saw the discussion about building for AMD64 by default, and I removed the AdditionalDependencies:MACHINE:AMD64 from configure.cpp. After I did that it built OK.
So I built the debug libs & DLLs and copied everything I thought I needed into the IM install dir besides the release libs & DLLs (because they have different names).
I then specified the debug libs for my debug project.
Now when running my APP in debug mode it no longer crashes, but when I try to open a JPEG or BMP file (the only two i've tried so far), i get:
Caught exception: Magick: NoDecodeDelegateForThisImageFormat `J:\t.jpg' @ error/constitute.c/ReadImage/532
from this code:
try
{
Image1=new Magick::Image(FileName);
}
catch( exception &error_ )
{
cout << "Caught exception: " << error_.what() << endl;
return 1;
}
However it works when running in release mode.
Any ideas?
When I tried to debug my APP, the first thing I noticed was that IM seems to share resource handles or maybe heap pointers between the different run-time libraries, causing a crash in the library code. The only way I know how this might happen is if IM has some code that is built when the APP is built and that code creates or uses resources/pointers also created/used by the IM DLLs (for example, IM might include a preprocessor macro or a C++ template that contains code that creates or uses such handles). Is that correct?
Anyway, moving forward on that theory I got the IM source code so I could build some debug libs that would use the same run-time lib that my APP uses when it is in debug mode, so that things wouldn't crash.
The first thing that happened was 64-bit/32-bit conflict. I need to create 32-bit binaries for distribution (because so many of my customers still use 32-bit OSs), so I saw the discussion about building for AMD64 by default, and I removed the AdditionalDependencies:MACHINE:AMD64 from configure.cpp. After I did that it built OK.
So I built the debug libs & DLLs and copied everything I thought I needed into the IM install dir besides the release libs & DLLs (because they have different names).
I then specified the debug libs for my debug project.
Now when running my APP in debug mode it no longer crashes, but when I try to open a JPEG or BMP file (the only two i've tried so far), i get:
Caught exception: Magick: NoDecodeDelegateForThisImageFormat `J:\t.jpg' @ error/constitute.c/ReadImage/532
from this code:
try
{
Image1=new Magick::Image(FileName);
}
catch( exception &error_ )
{
cout << "Caught exception: " << error_.what() << endl;
return 1;
}
However it works when running in release mode.
Any ideas?