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?
build debug IM, no delegates for BMP, JPG
Re: build debug IM, no delegates for BMP, JPG
It ~looks~ like I am now up and running. I have no idea why, but to debug a Visual C++ (ver 8 ) application, apparently one should NOT define the _DEBUG preprocessor macro in the debug build of the app, Instead, define NDEBUG (as you would in a release build), but still specify no optimization and include debug info as normal for a debug build of your app. By doing this, you can still link with the IM release libs in the standard binary IM distribution (so you don't have to build IM), but debugging your app still works OK.
BTW, IM is awesome.
BTW, IM is awesome.
Re: build debug IM, no delegates for BMP, JPG
This problem is fixed in the latest release of ImageMagick. 64-bit builds are now an option when you run the configure program.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.