[Dub-pm] big data structures relative to memory size

Fergal Daly fergal at esatclear.ie
Fri Apr 16 11:36:13 CDT 2004


Yeah, that's it. Have a look at the Inline::C cookbook for full details but
very briefly you create a Perl scalar in your C code and stuff the pointer
into that and return that to Perl. If you don't want to worry about garbage
collection then you should make sure that the scalar is a blessed object and
that it's DESTROY method calls something to free the memory. There's geansai
loads of examples in the docs although to be honest the one or two times I
wanted to mix Perl and C I ended up using XS. Inline::C was storing lots of
crap in hidden directories and some other stuff that I didn't like - can't
remember what anymore so maybe my gripes no longer exist. Give it a whirl
anyway, the examples are great,

F

On Fri, Apr 16, 2004 at 05:15:26PM +0100, Sean O'Riordain wrote:
> Hi Fergal!
> 
> have to think about that one!
> 
> if i malloc memory in C then go back to perl to pass info into C 
> again... how do i reference that memory again - i presume i pass the 
> info back and forth by reference, - or could it be still available as a 
> static type pointer... i'm missing a step here...



More information about the Dublin-pm mailing list