BPL BPL - 1 month ago 12
Python Question

SWIG_AsVal_wchar_t identifier not found

I'm having some issues with SWIG and wchat_t types, to reproduce the issue I got a little MCVE here

The problem is SWIG_AsVal_wchar_t is called but it's not defined anywhere.

I've tried following the accepted answer here but for some reason didn't work for me

How could I solve this?

PS: I've also posted the issue on github

Answer

In order to use wchar_t, you could include the interface cwstring.i instead of wchar.i.

This allows to build your sample with this modified libsystem.i :

%module libsystem
%include "cwstring.i" 
%{
#include "foo.h"
%}
%include "foo.h"

An other way is to include the missing fragment using the following libsystem.i:

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