Default Windows bnary distribution of Magick++ only works with Visual Studio 2010 (and with specific compiler options)
Anthony Berent <[email protected]> Mon, 21 Mar 2011 12:05:09 +0000
| Newsgroups | gmane.comp.video.image-magick.bugs |
|---|---|
| Message-ID | <[email protected]> |
Hi, I was using Magick++ in a Windows C++ project using the Windows binary release. I initially built it with Visual C++ 2010 Express using default release project options, and it worked fine. I later found, however, that if I tried using VS 2008, or VS 2005, or built in debug mode, my call to the image constructor Magic::Image(std::string filename) was failing. On investigation I discovered the reason for this is that different versions of VC++ use different versions of the standard template library. Since the string class is largely implemented in header files this causes an incompatibility in the layout of strings when they are passed across the DLL interface. This meant that the DLL was reading the file name incorrectly, hence causing the problems. In addition to reducing the usefulness of the current binary release, this problem could mean that programs built the current binary release are incompatible with future binary releases. I believe that, because of the potential for these sorts of problems, it is generally regarded as bad practice to use STL classes (or other template classes or inline functions) in DLL or shared library interfaces. Please: 1) Document this restriction, and the precise options and tools versions used to build the binary release. 2) Add to the Magic++ API constructors etc. that allow the use of all functionality without using template classes (e.g. by using C strings instead of stl strings). - Anthony P.S. Since our use of ImageMagick is quite simple we have worked round this for now by switching to using MagicWand, which does not have the same problems. -- IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.