Files
ViewDesignEngine/include/vde/core/platform.h
T
茂之钳 8d3d3cacfc
CI / Build & Test (push) Failing after 34s
CI / Release Build (push) Failing after 30s
Build & Test / build-and-test (push) Has been cancelled
Build & Test / python-bindings (push) Has been cancelled
fix: add cross-platform M_PI fallback in platform.h
2026-08-01 21:02:16 +08:00

44 lines
1.0 KiB
C++
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#pragma once
/// 平台抽象层
/// 跨平台兼容宏 + M_PI 补丁 (MSVC 未定义)
#ifndef M_PI
#define M_PI 3.14159265358979323846
#endif
#include <string>
namespace vde::platform {
/// 动态库句柄
using LibHandle = void*;
/// 加载动态库 (.so / .dll / .dylib / .so.hmos)
/// @return 非空 → 成功,nullptr → 失败
LibHandle load_library(const std::string& path);
/// 卸载
void unload_library(LibHandle h);
/// 查找符号
void* find_symbol(LibHandle h, const std::string& name);
/// 获取最后一次加载错误信息
std::string last_error();
/// 创建临时文件(跨平台安全)
/// @param prefix 文件名前缀
/// @param suffix 文件扩展名(如 ".dxf")
/// @param[out] path 返回临时文件完整路径
/// @return true 成功
bool make_temp_file(const std::string& prefix, const std::string& suffix, std::string& path);
/// 删除文件
bool delete_file(const std::string& path);
/// 执行系统命令
/// @return 0 成功
int run_command(const std::string& cmd);
} // namespace vde::platform