c++模板的swig包装问题

2024-09-30 16:20:17 发布

您现在位置:Python中文网/ 问答频道 /正文

我有一个swig文件,其中包含以下代码:

%module vgSofa

#define VG_SOFA_API

%import vgd/vgd.i
%import vgm/vgm.i


%template(BasicHandlerShp1) boost::shared_ptr<vgSofa::handler::BasicHandler>;


%{

#include "vgSofa/handler/BasicHandler.hpp"

%}

%template(BasicHandlerShp) vgd::Shp<vgSofa::handler::BasicHandler>;


%include "vgSofa/handler/BasicHandler.hpp"

其中vgd::Shp继承到boost::shared_ptr。 此代码生成包装器和python文件,但在生成的python文件中,我无权访问模板BasicHandlerShp中的vgSofa::handler::BasicHandler函数。 如何在BasicHandlerShp中访问这些函数? 谢谢您!!你知道吗


Tags: 文件importincludetemplatehandlersharedhppboost