feat: 新增 C API 导出与 Python 封装#197
Merged
Merged
Conversation
新增独立的 op_c_api 动态库目标,补齐公开头文件和导出实现。 C API 覆盖现有 libop 能力,并补上整数、浮点数和字符串 内存读写接口。COM 接口同步增加这些方法,避免不同调用入口 能力不一致。 调整 CMake 安装规则和构建脚本,让 x86/x64 都能产出 op_c_api_x86/op_c_api_x64。libop 作为静态实现被 C API 目标 复用,减少重复链接问题。 新增 Python 包装层,通过 ctypes 调用 C API。Python 侧只保留 snake_case 方法,并提供 constants 模块保存窗口、绑定、图色 和 OpenCV 等常用模式值。
WallBreaker2
added a commit
that referenced
this pull request
Jun 18, 2026
This PR adds an optional YOLO HTTP detection integration that follows the existing OCR HTTP-service pattern. New COM/C++ APIs: - SetYoloEngine(path_of_engine, dll_name, argv) - YoloDetect(x1, y1, x2, y2, conf, iou) - YoloDetectFromFile(file_name, conf, iou) The DLL does not embed YOLO/ONNX/DirectML runtime dependencies. It only captures or loads images and sends raw pixels to an external HTTP service, similar to the current generic OCR service flow. Refactored to extract shared HTTP infrastructure into HttpWrapper, eliminating ~200+ lines of duplicated code between OcrWrapper and YoloWrapper. Resolved merge conflicts with master (PR #197 C API changes). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Add optional YOLO HTTP detection integration
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
说明
新增独立的 C API 动态库导出,方便非 COM 场景直接调用 libop。
这次同时补了 Python 封装层,Python 侧通过 ctypes 调用 C API,
不再依赖 COM,也只保留 snake_case 风格的方法名。
主要改动
op_c_api_x86/op_c_api_x64构建目标include/op_c_api.h和 C API 实现验证
libopop_c_api_x64op_x64op_c_api_x64.dllpython -m compileall -q python\op通过