New glib FD APIs in 21.12 do not build on MSVC
The recent 21.12.0 release added new file-descriptor APIs to the glib module that don't build on MSVC. We're being bitten by these in the conda-forge Poppler package. The errors I've encountered are:
- (not directly related): in
poppler/ImageEmbeddingUtils.cc
, build failure due to redefinition ofINT32
in libjpeg, because the Windows system headers need to be included first. Can be solved by moving the libjpeg #include to the bottom of the file preamble - in
glib/poppler-document.cc
, need to#include <glib.h>
before the#ifndef G_OS_WIN32
because otherwise it will never be defined! - Unguarded use of
close()
inpoppler_ps_file_finalize
- Use of various functions that on Windows are available with underscore-prefixed names; in the conda-forge build these yield deprecation warnings but not build failures:
strdup
,dup
,fileno
,fdopen
,stricmp
.
Note that the preexisting poppler_document_new_from_fd
is guarded with #ifndef G_OS_WIN32
so that on Windows the function just always fails. One option would be to do likewise for the new APIs. Also note that it looks like _close
is available on MSVC, it just doesn't have the close
compatibility wrapper unlike the other problematic FD functions.
Edited by Peter Williams