diff options
author | kenton@google.com <kenton@google.com@630680e5-0e50-0410-840e-4b1c322b438d> | 2009-12-19 04:50:00 +0000 |
---|---|---|
committer | kenton@google.com <kenton@google.com@630680e5-0e50-0410-840e-4b1c322b438d> | 2009-12-19 04:50:00 +0000 |
commit | 684d45b2feac114a0152cf4458846fbeca61b5d9 (patch) | |
tree | 781a604308f2866d6b321d6cfbe238c2732cc469 /src/google/protobuf/compiler/plugin.cc | |
parent | bdbb863099c7ef3e1ecdeefa732798e095b85fb8 (diff) |
Fix build on MinGW/Win32 (including implementing Subprocess using CreateProcess()).
Diffstat (limited to 'src/google/protobuf/compiler/plugin.cc')
-rw-r--r-- | src/google/protobuf/compiler/plugin.cc | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/google/protobuf/compiler/plugin.cc b/src/google/protobuf/compiler/plugin.cc index b64a8413..4757652f 100644 --- a/src/google/protobuf/compiler/plugin.cc +++ b/src/google/protobuf/compiler/plugin.cc @@ -36,6 +36,11 @@ #include <set> #include <unistd.h> +#ifdef _WIN32 +#include <io.h> +#include <fcntl.h> +#endif + #include <google/protobuf/stubs/common.h> #include <google/protobuf/compiler/plugin.pb.h> #include <google/protobuf/compiler/code_generator.h> @@ -80,6 +85,11 @@ int PluginMain(int argc, char* argv[], const CodeGenerator* generator) { return 1; } +#ifdef _WIN32 + _setmode(STDIN_FILENO, _O_BINARY); + _setmode(STDOUT_FILENO, _O_BINARY); +#endif + CodeGeneratorRequest request; if (!request.ParseFromFileDescriptor(STDIN_FILENO)) { cerr << argv[0] << ": protoc sent unparseable request to plugin." << endl; |