找不到SWIG_AsVal_wchar_t标识符

时间:2016-10-20 01:50:29

标签: python c++ swig

我遇到了一些SWIG和wchat_t类型的问题,为了重现这个问题,我得到了一点MCVE here

问题是调用了SWIG_AsVal_wchar_t,但它没有在任何地方定义。

我已尝试按照接受的答案here但由于某种原因对我不起作用

我怎么解决这个问题?

PS:我也在github

上发布了这个问题

1 个答案:

答案 0 :(得分:1)

为了使用wchar_t,您可以包含接口cwstring.i而不是wchar.i

这允许使用此修改后的libsystem.i

构建您的示例
%module libsystem
%include "cwstring.i" 
%{
#include "foo.h"
%}
%include "foo.h"

另一种方法是使用以下libsystem.i包含缺失的片段:

%module libsystem
%include "wchar.i"
%include <typemaps/wstring.swg> 
%{
#include "foo.h"
%}
%include "foo.h"