mcpp index

mcpplibs.openkal-posix

#include

An implementation of openkal written above a POSIX C library, for the systems that have no implementation of their own

#include <openkal.h>
mcpp add mcpplibs.openkal-posix@0.2.0

用法

来自本仓库自己的测试项目 —— CI 真的编译并运行过,不是为了网站写的。

// openkal-posix through the index, observed through the C surface.
#include <cstdio>
#include <cstring>
#if defined(__linux__) || defined(__APPLE__)
#include <openkal.h>

int main() {
    int failures = 0;
    auto check = [&](bool held, const char* what) {
        if (!held) { std::printf("FAIL: %s\n", what); ++failures; }
    };
    const kal_u64 stated = kal_interfaces();
    check((stated & KAL_IFACE_FS) && (stated & KAL_IFACE_PROCESS) && (stated & KAL_IFACE_TASK),
          "the interfaces it provides are stated");
    check(!(stated & KAL_IFACE_NET) && !(stated & KAL_IFACE_PROF), "and those it does not are not");
    check(kal_stream_write(kal_stdout(), "openkal-posix\n", 14) == 14, "a stream is written");
    char sys[32] = {};
    const kal_intptr n = kal_env_system(sys, sizeof sys - 1);
    check(n > 0, "the system is named");
    kal_dir here{};
    check(kal_fs_preopen_count() > 0 && kal_fs_preopen(0, &here, nullptr, 0, nullptr) == kal_ok,
          "a directory is granted");
// …

tests/examples/openkal-posix/tests/kal.cpp · 项目 tests/examples/openkal-posix

构建 · 上游清单

manifest version
0.2.0
dependencies
openkal
来源
https://raw.githubusercontent.com/mcpplibs/openkal-posix/0.2.0/mcpp.toml

版本

版本平台 镜像sha256
0.2.0 最新 LinuxWindowsmacOS GLOBAL CN 23eb05805a5e…
0.1.1 LinuxWindowsmacOS GLOBAL CN 070963e16828…
0.1.0 LinuxWindowsmacOS GLOBAL CN 09878176d163…