Page 1 of 1
ExceptionInfo and ColorInfo - compilation conflict OS X
Posted: 2009-10-02T07:42:05-07:00
by John.Green
Hello
I've encountered an issue while starting to try to get ImageMagick integrated with my code. I'm running Xcode 3.1 (under Mac OS X 10.5.7) building to the 10.4 sdk. My code builds an Acrobat plugin, a Mach-O Type of "Bundle," not a traditional .app file.
I had compilation conflicts with ExceptionInfo and ColorInfo. These were also both previously defined in Apple headers. I renamed them to ExceptionInfo_ImageMagick and ColorInfo_ImageMagick and recompiled.
I found it very odd that I had to do this. Well, I guess not since namespace collisions are not that rare, but odd in that my googling and searching the web and this forum didn't show up anybody else encountering this except for a post by Scott Anguish (!) from 2001: see
http://markmail.org/message/3rsgwrnntahvtzhi. Also, Platforms.txt is silent on this issue.
Was my "fix" the proper approach? Since I'm working in C, not C++ I cannot use "namespaces."
Any help is appreciated. Thanks!
John
Re: ExceptionInfo and ColorInfo - compilation conflict OS X
Posted: 2009-10-02T16:29:46-07:00
by magick
These were also both previously defined in Apple headers
Which Apple headers? We tried a search on Snow Leopard and could not find any instances of ExceptionInfo other than in ImageMagick source and web pages.
One of the advantages of modern languages such as Object C, C++, Java, etc., is to avoid namespace collision. Given the collision does exist we do not have any specific recommendations. We certainly cannot change it within ImageMagick since its a public structure in widespread use since 1990.
Re: ExceptionInfo and ColorInfo - compilation conflict OS X
Posted: 2009-10-16T12:51:45-07:00
by John.Green
Sorry to take so long to get back to you. Here are the exact error messages:
usr/local/include/ImageMagick/magick/magick-type.h:179: error: conflicting declaration 'typedef struct _ExceptionInfo ExceptionInfo'
/Developer/SDKs/MacOSX10.4u.sdk/System/Library/Frameworks/CoreServices.framework/Frameworks/CarbonCore.framework/Headers/MachineExceptions.h:196: error: 'ExceptionInfo' has a previous declaration as 'typedef union ExceptionInfo ExceptionInfo'
and
/usr/local/include/ImageMagick/magick/color.h:59: error: conflicting declaration 'typedef struct _ColorInfo ColorInfo'
/Developer/SDKs/MacOSX10.4u.sdk/System/Library/Frameworks/ApplicationServices.framework/Frameworks/QD.framework/Headers/Palettes.h:63: error: 'ColorInfo' has a previous declaration as 'typedef struct ColorInfo ColorInfo'
Note: I've since given up on the Wand and gone straight to the Magick++ API, much nicer API so I really don't need a solution, but I thought you might want know. Also, it is clear that this has something to do with the type of xcode project I have. Mine creates a bundle. I'm isolating another question so I made a straight C++ command line program in xcode it handles the Wand just fine.
But thank you so much for getting back to me.
John
Re: ExceptionInfo and ColorInfo - compilation conflict OS X
Posted: 2014-06-11T06:19:27-07:00
by jheld
magick wrote:These were also both previously defined in Apple headers
Which Apple headers? We tried a search on Snow Leopard and could not find any instances of ExceptionInfo other than in ImageMagick source and web pages.
One of the advantages of modern languages such as Object C, C++, Java, etc., is to avoid namespace collision. Given the collision does exist we do not have any specific recommendations. We certainly cannot change it within ImageMagick since its a public structure in widespread use since 1990.
I disagree that you cannot change this. It's quite simple, really. Changing your variable name to be something else is trivial. But, then again, I can create a custom version of the library with exactly that adjustment.
Re: ExceptionInfo and ColorInfo - compilation conflict OS X
Posted: 2014-06-11T08:43:51-07:00
by magick
ImageMagick ensures a stable API and ABI, see
http://upstream-tracker.org/versions/imagemagick.html. Changing the names of these structures would break backward compatibility and cause untold problems for the thousands of ImageMagick wappers and applications in the wild.