mingw-w64 dllimport definition
Posted: 2014-06-15T22:04:39-07:00
I tried to compile and use ImageMagick-6.8.9-3 on 64-bit Windows 7 with mingw-w64 (gcc 4.8.2 seh) and msys.
The build failed for me (with any conceivable combination of configure options) with linking errors in the form of "undefined reference to __imp_[imagemagick entry point] (e.g. __imp_MagickWandGenesis).
The output of "nm libMagickWand.dll.a | grep MagickWandGenesis" was
0000000000000000 I __imp_MagickWandGenesis
0000000000000000 T MagickWandGenesis
The problem can be fixed by changing
#define WandExport __attribute__((dllimport))
into
#define WandExport
in wand/method-attribute.h
and similarily changing the define MagickExport in magick/method-attribute.h.
It might be good to add an appropriate #ifdef to */method-attribute.h to avoid the incorrect symbol naming altogether on win64/mingw-w64.
The build failed for me (with any conceivable combination of configure options) with linking errors in the form of "undefined reference to __imp_[imagemagick entry point] (e.g. __imp_MagickWandGenesis).
The output of "nm libMagickWand.dll.a | grep MagickWandGenesis" was
0000000000000000 I __imp_MagickWandGenesis
0000000000000000 T MagickWandGenesis
The problem can be fixed by changing
#define WandExport __attribute__((dllimport))
into
#define WandExport
in wand/method-attribute.h
and similarily changing the define MagickExport in magick/method-attribute.h.
It might be good to add an appropriate #ifdef to */method-attribute.h to avoid the incorrect symbol naming altogether on win64/mingw-w64.