Hi,
I am passing a const wchar_t* from a function MyFunc() in my XS file.
I have a custom typemap for const wchar_t*  :

const wchar_t *         T_WCHAR

INPUT
T_WCHAR
        $var = ($type)SvPV_nolen($arg)

OUTPUT
T_WCHAR
        sv_setpv((SV*)$arg, (char *) $var, wcslen($var)*sizeof($type));

In my perl script I want to do a string comparison where the first letter is
say 'h'. My perl script is -
$Name = &Config::MyFunc();
print $Name;
if($Name =~ m/^h/)
{
    do something
}

The $Name has a correct value as I see when I print it. But, the comparison
does not work!
The same thing works if the function returns a const char* which in my
typemap  is -
const char*     T_PV

Is my typemap for const wchar_t* incorrect ?
If yes, then how do I get a proper value when I print, and what could be
done so that the comparison works?

Thanks,
Manisha


Reply via email to