Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions src/util/pio.c
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,16 @@
#include "util/strfuncs.h"
#include "util/ckd_alloc.h"

/* The MSVC/Win32 C runtime exports the pipe functions as _popen/_pclose.
* The POSIX spellings are declared in <stdio.h> (so HAVE_POPEN is defined
* and the code compiles) but are not resolvable when linking a shared
* library, which breaks an MSVC DLL build. Map to the underscore
* spellings on Win32, matching the guard already used for _pclose. */
#if defined(_WIN32) && !defined(__SYMBIAN32__)
#define popen _popen
#define pclose _pclose
#endif

#ifndef EXEEXT
#define EXEEXT ""
#endif
Expand Down Expand Up @@ -186,11 +196,7 @@ fclose_comp(FILE * fp, int32 ispipe)
{
if (ispipe) {
#ifdef HAVE_POPEN
#if defined(_WIN32) && (!defined(__SYMBIAN32__))
_pclose(fp);
#else
pclose(fp);
#endif
#endif
}
else
Expand Down