On Fri, Nov 19, 2004 at 01:39:29AM -0500, Eric Garland wrote:
> If I call it like this:
> 
>   $bytes_read = $tag->funny_internal_function_name( $tag, 
>   $shared_array->[BUFFER], $offset, $length, $options)
> 
> $shared_array->[BUFFER] stays empty.
> 
> 
> If I call it like this:
> 
>   my ($tmp);
>   $bytes_read = $tag->funny_internal_function_name( $tag, $tmp, $offset, 
>   $length, $options)
>   $shared_array->[BUFFER] = $tmp;
> 
> Everything seems to work right.  Is there something magical about shared
> variables that makes them unable to be modified like non-shared scalars
> from XS land?  Is there any way to fill in these new fun shared scalars
> from XS?
> 
> Thanks
>       -Eric
> 
> 
> 
> For those who care, my XS code looks like this:
> 
> void
> funny_internal_function_name (pTag, pValue, pOffset, pReadLength, pOptions)
>         const FPTagRef pTag
>         const FPLong pOffset
>         const FPLong pReadLength
>         const FPLong pOptions
>         SV * pValue
>     PREINIT:
>         FPStreamRef pStream;
>         char * value;
>     CODE:
>         sv_setpvn( pValue, "", 0);
>         value = (char *) SvGROW(pValue, pReadLength);
>       
>               **stuf you don't care about that writes to the buffer
>               **referred to by "value" and returns a length in pReadLength
> 
>         SvCUR_set(pValue, pReadLength);

I'm guessing you need a
         if (SvSMAGICAL(pValue)) mg_set(pValue);
at the end.

Don't know if XS has some other way to make sure that happens.

Reply via email to