This commit is contained in:
wangjiyu 2025-04-10 18:14:30 +08:00
parent 6e28716d33
commit c8e5a8d996
2 changed files with 12 additions and 17 deletions

View File

@ -1,12 +1,8 @@
// rtc_plugins.cpp // rtc_plugins.cpp
//#include "./util/numpyConfig.h" #define IMPLEMENT_NUMPY_API // 标记这是实现文件
#include "util/numpyStub.h"
#define PY_ARRAY_UNIQUE_SYMBOL RTC_PLUGINS_ARRAY_API // 内部实现专用符号 #include "util/RTCContext.h"
#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION
#include "./util/RTCContext.h"
#include <numpy/arrayobject.h>
// 提供转换接口 // 提供转换接口
void** get_numpy_api() { void** get_numpy_api() {

View File

@ -1,13 +1,12 @@
// numpy_stub.h // numpy_interface.h (新建)
#pragma once #pragma once
#ifdef __cplusplus #ifdef IMPLEMENT_NUMPY_API
extern "C" { // 主模块实现路径
#endif #define PY_ARRAY_UNIQUE_SYMBOL RTC_PLUGINS_ARRAY_API
#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION
// 声明为不完整类型(阻止链接器匹配) #include <numpy/arrayobject.h>
extern struct NumPyAPIWrapper* RTC_PLUGINS_ARRAY_API; #else
// 用户头文件路径
#ifdef __cplusplus extern void* RTC_PLUGINS_ARRAY_API[]; // 严格匹配NumPy类型
}
#endif #endif