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
//#include "./util/numpyConfig.h"
#define PY_ARRAY_UNIQUE_SYMBOL RTC_PLUGINS_ARRAY_API // 内部实现专用符号
#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION
#include "./util/RTCContext.h"
#include <numpy/arrayobject.h>
#define IMPLEMENT_NUMPY_API // 标记这是实现文件
#include "util/numpyStub.h"
#include "util/RTCContext.h"
// 提供转换接口
void** get_numpy_api() {

View File

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