You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@perl.apache.org by Stas Bekman <st...@stason.org> on 2001/11/26 10:58:43 UTC
un-acceptable function prototypes in Wrap/XS?
I've learned that WRAP/XS cannot handle 'char **' prototypes. It just
steps over the function.
I still wasn't able to user the same workaround used for
modperl_bucket_read. Any solutions for that? I'm trying to generate XS
for the function of this type:
int mpxs_Apache__Foo_test(const char **argv);
if I pass 'AV', what's the easy way to convert it to 'char **', the
default typemap is supposed to do that as T_PACKEDARRAY XS type. Should
I call:
T_PACKEDARRAY
$var = XS_unpack_$ntype($arg)
Are there any other "invalid" prototypes and workarounds for these
documented somewhere? At least if the function is rejected is it
possible to print a warning or something?
Thanks.
_____________________________________________________________________
Stas Bekman JAm_pH -- Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide http://perl.apache.org/guide
mailto:stas@stason.org http://ticketmaster.com http://apacheweek.com
http://singlesheaven.com http://perl.apache.org http://perlmonth.com/
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org
Re: un-acceptable function prototypes in Wrap/XS?
Posted by Doug MacEachern <do...@covalent.net>.
On Thu, 29 Nov 2001, Stas Bekman wrote:
> do we have such a function? I couldn't find it. I've started to grab
> strings in loop over av_len:
>
> av_argv = (AV*)SvRV(ST(1));
> (const char *)SvPV_nolen(AvARRAY(av_argv)[i]))
>
> but I have a gut feeling that it's not very effective way to go.
we don't have such a function. you would need to iterate over the AV to
build it. then would either need to malloc/free the char ** or create an
apr_array_header_t with given pool and pass (const char **)arr->elts to
the C function.
> it doesn't. So where is the magic thing?
nowhere. the user is supposed to define XS_unpack_$ntype
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org
Re: un-acceptable function prototypes in Wrap/XS?
Posted by Stas Bekman <st...@stason.org>.
Doug MacEachern wrote:
> On Mon, 26 Nov 2001, Stas Bekman wrote:
>
>
>>I've learned that WRAP/XS cannot handle 'char **' prototypes. It just
>>steps over the function.
>>
>
> we shouldn't be using char ** prototypes for anything.
yes, yes, I've moved on since then, it was my initial thought.
>>I still wasn't able to user the same workaround used for
>>modperl_bucket_read. Any solutions for that?
>>
>
> the mpxs_modperl_bucket_read takes an SV* for that argument, then calls
> modperl_bucket_read with &str.
yup, I've looked at it already.
>>I'm trying to generate XS for the function of this type:
>>
>>int mpxs_Apache__Foo_test(const char **argv);
>>
>
> that should be (AV *av) which uses the T_AVREF typemap.
> then have a modperl_util.c function to convert from AV to char **.
do we have such a function? I couldn't find it. I've started to grab
strings in loop over av_len:
av_argv = (AV*)SvRV(ST(1));
(const char *)SvPV_nolen(AvARRAY(av_argv)[i]))
but I have a gut feeling that it's not very effective way to go.
>>if I pass 'AV', what's the easy way to convert it to 'char **', the
>>default typemap is supposed to do that as T_PACKEDARRAY XS type. Should
>>I call:
>>
>>T_PACKEDARRAY
>> $var = XS_unpack_$ntype($arg)
>>
>
> but notice the function XS_unpack_charPtrPtr doesn't actually exist.
it doesn't. So where is the magic thing?
> and we should be using \@array not @array anyhow.
yes, I do use \@array.
_____________________________________________________________________
Stas Bekman JAm_pH -- Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide http://perl.apache.org/guide
mailto:stas@stason.org http://ticketmaster.com http://apacheweek.com
http://singlesheaven.com http://perl.apache.org http://perlmonth.com/
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org
Re: un-acceptable function prototypes in Wrap/XS?
Posted by Doug MacEachern <do...@covalent.net>.
On Mon, 26 Nov 2001, Stas Bekman wrote:
> I've learned that WRAP/XS cannot handle 'char **' prototypes. It just
> steps over the function.
we shouldn't be using char ** prototypes for anything.
> I still wasn't able to user the same workaround used for
> modperl_bucket_read. Any solutions for that?
the mpxs_modperl_bucket_read takes an SV* for that argument, then calls
modperl_bucket_read with &str.
> I'm trying to generate XS for the function of this type:
>
> int mpxs_Apache__Foo_test(const char **argv);
that should be (AV *av) which uses the T_AVREF typemap.
then have a modperl_util.c function to convert from AV to char **.
> if I pass 'AV', what's the easy way to convert it to 'char **', the
> default typemap is supposed to do that as T_PACKEDARRAY XS type. Should
> I call:
>
> T_PACKEDARRAY
> $var = XS_unpack_$ntype($arg)
but notice the function XS_unpack_charPtrPtr doesn'HREFtually exist.
and we should be using \@array not @array anyhow.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org