Hi Shlomi and Jenda,

It's the xs problem. In the xs file I used, a structure with size 24KB is
defined, and a pointer to this structure is declared in the ".xs" file,
which corresponds to the pointer in the C function, and the scalar variable
in Perl.

After enlarging the size of the structure, the problem is solved.

Thank all of you for your kind help.

On Wed, Jun 30, 2010 at 6:20 PM, Jenda Krynicky <je...@krynicky.cz> wrote:

> From: Shlomi Fish <shlo...@iglu.org.il>
> > On Wednesday 30 Jun 2010 10:01:45 Yang Zhou wrote:
> > > Hi Shlomi,
> > >
> > > Thanks for your help.
> > >
> > > I tried the "my $buffer = "\0" x 65536; " method, but "segmentation
> fault"
> > > in the C function remains.
> > > I know little about "XS", it seems a declaration of the interface
> between
> > > Perl and C? Just a glimps of the link in your last mail, I can't find
> any
> > > Keyword which can be used to solve this problem.
> > >
> >
> > You need to allocate a buffer for that in your C code using malloc() pass
> it
> > to the function and then convert it to something that Perl can
> understand.
>
> Not necessarily, it is possible to preallocate in Perl and then use
> that buffer.
>
> Please show us your code, preferably trimmed down and let's see.
>
> Jenda
> ===== je...@krynicky.cz === 
> http://Jenda.Krynicky.cz<http://jenda.krynicky.cz/>=====
> When it comes to wine, women and song, wizards are allowed
> to get drunk and croon as much as they like.
>        -- Terry Pratchett in Sourcery
>
>
> --
> To unsubscribe, e-mail: beginners-unsubscr...@perl.org
> For additional commands, e-mail: beginners-h...@perl.org
> http://learn.perl.org/
>
>
>


-- 
Best regards,
Yang Zhou
------------------------------------------------------------------
Any intelligent fool can make things bigger and
more complex... It takes a touch of genius -
and a lot of courage to move in the opposite
direction.                   -- Albert Einstein

Reply via email to