This archive contains answers to questions sent to Unidata support through mid-2025. Note that the archive is no longer being updated. We provide the archive for reference; many of the answers presented here remain technically correct, even if somewhat outdated. For the most up-to-date information on the use of NSF Unidata software and data services, please consult the Software Documentation first.
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! -Ward > Hi, > > I was able to compile netCDF 4.3.3.1 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