Page 1 of 1

mingw-w64 dllimport definition

Posted: 2014-06-15T22:04:39-07:00
by ekpyron
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.

Re: mingw-w64 dllimport definition

Posted: 2014-06-16T17:29:27-07:00
by magick
We had to make a couple of minor patches but ImageMagick compiled with these commands:
  • cd ImageMagick-6.8.9-4
    ./configure --disable-shared
    make
We're using gcc.exe (tdm64-2) 4.8.1 in the MinGW 64-bit build environment. Download 6.8.9-4 from the normal download locations but in the 'beta/' folder. Do not download until tomorrow. We need time for the patches to mirror.