[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[netCDF #DMO-203112]: suggestion / patch (?) for building on minGW32-w64

Hello Thomas,

Thank you for the bug report and the suggested fix; I did not realize there was 
a problem with cmake on minGW32-w64.  I will investigate this further, and I 
will see what changes we can make so that your suggested patch is robust enough 
for other platforms as well.

Thanks again!


> Hi,
> I was able to compile netCDF on windows using the minGW32-w64
> compiler and CMake without too much trouble. However, I did have to make
> a slight change to the file "include/onstack.h".
> There, the macros ALLOCATE_ONSTACK and FREE_ONSTACK (used in
> "libsrc/putget.c") should be defined, but on my platform, the #ifdef's
> left them undefined (so compilation of putget.c failed). I did not
> investigate which combination of prepocessor flags caused this (I know
> minGW32 defines __GNUC__, but does not provide alloca.h).  mingw does
> provide variable-length arrays, so I worked around the problem by
> modifying the first
> #ifdef(__HAVE_ALLOCA__) ...
> into
> #if defined (__MINGW32__)
> #define ALLOC_ONSTACK(name, type, nelems) \
> type name[nelems]
> #define FREE_ONSTACK(name)
> #elif defined(HAVE_ALLOCA)
> [... rest of file unchanged]
> This seems to work on my platform, but is probably not a sufficiently
> robust solution for your library.  I hope this can help to fix the
> problem for minGW in a future release, do not hesitate to contact me.
> Kind regards,
> Thomas
> --
> Thomas Danckaert
> Belgian Institute for Space Aeronomy (IASB/BIRA)
> Ringlaan 3, B-1180 UKKEL BELGIUM
> http://www.aeronomie.be
> Tel: +32 (0)2 8909-870 (office)
> address@hidden

Ticket Details
Ticket ID: DMO-203112
Department: Support netCDF
Priority: Normal
Status: Closed

NOTE: All email exchanges with Unidata User Support are recorded in the Unidata inquiry tracking system and then made publicly available through the web. If you do not want to have your interactions made available in this way, you must let us know in each email you send to us.