Just another Perl shrine | |
PerlMonks |
Re: char ** typemap in perlxsby rafl (Friar) |
on Apr 16, 2008 at 16:21 UTC ( [id://680849]=note: print w/replies, xml ) | Need Help?? |
The default typemap maps char ** to T_PACKEDARRAY. The input typemap for that looks like this:
so to convert the perl argument to a char ** value it will call XS_unpackcharPtrPtr. However implementing this function is something you will need to do as xsubpp can't know what the meaning of the data is. The following (untested) code might be useful if you want to pass an array reference from perl and your c code expects a NULL terminated list of strings:
As this function allocates memory you will need to free the return value when you don't need it anymore. The CLEANUP section of an xsub might be a good place for that.
In Section
Seekers of Perl Wisdom
|
|