17
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-10-17 14:29:20 +02:00
Files
maszyna/extras/piped_proc.cppm
maj00r 2896c2dd60 add the C library headers MSVC needs
Unqualified uint8_t/size_t and friends were reaching 24 units through
some other header on libstdc++; MSVC's STL does not do that, which broke
gl/ubo.cppm (and made its UBS_PAD macro look like garbage). Also
silences C5244, MSVC's counterpart to the clang warning about glm being
included in the module purview, which is deliberate here.
2026-09-10 00:10:52 +02:00

43 lines
788 B
C++

/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
module;
#include <cstddef>
#ifdef __unix__
#include <cstdio>
#endif
#ifdef __unix__
#elif _WIN32
#include "winheaders.h"
#endif
#include <string>
export module eu07.extras.piped_proc;
export {
#ifdef __unix__
#elif _WIN32
#endif
class piped_proc
{
private:
#ifdef __unix__
FILE *file = nullptr;
#elif _WIN32
HANDLE proc_h = nullptr;
HANDLE pipe_rd = nullptr;
HANDLE pipe_wr = nullptr;
#endif
public:
piped_proc(std::string cmd, bool write = false);
size_t read(unsigned char *buf, size_t len);
size_t write(unsigned char *buf, size_t len);
~piped_proc();
};
} // export