libWand and Exception Handling

The MagickWand interface is a new high-level C API interface to ImageMagick core methods. We discourage the use of the core methods and encourage the use of this API instead. Post MagickWand questions, bug reports, and suggestions to this forum.
Post Reply
oliver.andrich

libWand and Exception Handling

Post by oliver.andrich » 2006-10-01T14:35:44-07:00

Hi,

is there a rule of thumb when to check for exceptions, when using libWand? Everytime a Boolean is returned? Or is there any documentation available, that clearly states when to check?

Best regards,
Oliver Andrich

User avatar
magick
Site Admin
Posts: 10935
Joined: 2003-05-31T11:32:55-07:00

Post by magick » 2006-10-01T16:10:14-07:00

In most cases you check for an exception when a method returns MagickFalse which indicates the method failed. The exception will tell you why the method failed.

oliver.andrich

Post by oliver.andrich » 2006-10-01T16:36:16-07:00

magick wrote: In most cases you check for an exception when a method returns MagickFalse which indicates the method failed. The exception will tell you why the method failed.


Okay, this is good to now.

And another question if have still on my mind. Is it absolutely essential to call MagickWandGenesis and MagickWandTerminus? I ask, cause I have code that is working without it.

Best regards,
Oliver

User avatar
magick
Site Admin
Posts: 10935
Joined: 2003-05-31T11:32:55-07:00

Post by magick » 2006-10-01T17:03:44-07:00

MagickWandGenesis() and MagickWandTerminus() are optional. The API will automatically initialize its environment (i.e. MagickWandGenesis()), however, it will not automatically free all resources when you are finished with the API unless you call MagickWandTerminus() or exit your program.

Post Reply