Re: Compile on Windows

Bob Friesenhahn <[email protected]> Tue, 31 Mar 2020 15:26:06 -0500 (CDT)
Newsgroups gmane.comp.video.graphicsmagick.help
Message-ID <[email protected]>
On Tue, 31 Mar 2020, Pro Turm wrote:

> How do you compile on windows?
> Following more or less this http://www.graphicsmagick.org/INSTALL-windows.html#installing-from-source-code http://www.graphicsmagick.org/INSTALL-windows.html#installing-from-source-code,
> I tried to integrate the GM project into mine.
>
> Unfortunately, Im getting many error messages like
> ...
> cdjpeg.c(150): error C2491: 'read_stdin': definition of dllimport function not allowed
> ...
> jccoefct.c(411): error C2491: 'jinit_c_coef_controller': definition of dllimport function not allowed
> etc.
>
> So, probably Im missing something in the configuration ?

I suggest looking at a generated project file for a component which is 
similar to yours, such as for the 'gm' utility, and see what settings 
it uses.

Similar the annoying include path, there are some annoying definitions 
produced in the generated project files and the header files react to 
them.  The definitions include these:

  _MT, _LIB, _DLL, _MAGICKMOD_, and _MAGICKLIB_, MSWINDOWS

See magick/common.h in the section protected by

#if defined(MSWINDOWS) && !defined(__CYGWIN__)

for the grody details.

Also, see this comment in magick/studio.h which I added to make sure 
that I have some clue as to how things work:

   When using Autoconf configure script, BuildMagickModules is defined by
   magick/magick_config.h when modules are to be built.  Building modules
   requires that support for shared libraries be enabled.

   When using Visual Studio and when using the Autoconf configure script with
   MinGW these options are supplied when compiling the associated components:

     libMagick:           _DLL _MAGICKMOD_ _MAGICKLIB_
     module:              _DLL
     executable/Magick++: _DLL _MAGICKMOD_

   The Visual Studio build only knows how to build a static build, or a DLL
   modules-based build.  The Autotools-based build knows how to build static,
   shared, and modules builds.

   Libtool's libltdl is required to build modules when the Autoconf configure
   script is used.

Bob
-- 
Bob Friesenhahn
[email protected], http://www.simplesystems.org/users/bfriesen/
GraphicsMagick Maintainer,    http://www.GraphicsMagick.org/
Public Key,     http://www.simplesystems.org/users/bfriesen/public-key.txt