[Israel.pm] Wide character support in Perl?
Issac Goldstand
margol at beamartyr.net
Sun Oct 24 01:31:57 EEST 2004
I'm trying to write an XS wrapper for a C API which uses wide character
strings (wchar_t*) . According to the main typemap, a wchar_t * is a normal
T_PV - and thus gets a direct string --> string conversion from Perl to C.
However, I seem to be getting a char * after such a conversion, and thus
have to define my own typemap as such:
T_MYFilename
char *tmp=(char *)SvPV_nolen($arg);
New(1,$var,sv_len($arg)*sizeof(wchar_t),MYFilename);
mbstowcs($var,tmp,sv_len($arg)*sizeof(wchar_t))
That works. But it seems like an aweful complication. Am I missing
something?
More information about the Perl
mailing list