Page 1 of 1

Unhandled exception if I try to read or write (WinXP)

Posted: 2008-08-27T09:53:42-07:00
by Moschops
I've had to move to WinXP and am writing some new code. The following seems to work fine:

Code: Select all

	

        Magick::InitializeMagick("C:\Program Files\ImageMagick-6.4.3-Q16");
	Magick::Image blank_image("640x480", "white");
	blank_image.label("Magick++");
	blank_image.pixelColor(50,50,Magick::Color("Red"));
However, if i try to read from a file or write out to a file, for example by adding this code to the bottom:

Code: Select all

	blank_image.write("out.png");
I get the following complaint:

0xC0000005: Access violation writing location 0xce168be4.

I presume that if there was some problem linking to the dll or the header, none of the previous lines would have worked, so I'm somewhat stumped as to where I'm going wrong. When I insert these lines into one of the provided demo programs (demo.cpp) it performs as expected.

I'm new to using imagemagick under WinXP, so I've no doubt I've missed some setting or the like. Can anyone enlighten me? I've started comparing all the settings, but since the demo program is set to be a console program and the program I'm using this in is MFC, I can't make all the settings identical.

Re: Unhandled exception if I try to read or write (WinXP)

Posted: 2008-08-27T10:25:52-07:00
by Moschops
Addendum:

Commenting out the line

Code: Select all

  Magick::InitializeMagick("C:\Program Files\ImageMagick-6.4.3-Q16");
in both the demo programe and my program leads to identical behaviour, so maybe I haven't initialised the library after all, but since the demo program works without it, it doesn't seem to be doing anything anyway. It's a shame that Magick::InitializeMagick returns void - is there a reason why it doesn't return some value indicating success or a reason for failure?

Is there a function I can run that would definitely indicate whether or not this line has had an effect?

Further addendum:

Rooting around, I find that many people have had this exact problem in the past and nobody has ever come up with a solution... maybe it's time to look at an alternative library, given that I'm not going to rewrite Magick++ myself.