[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

pointer to c array in Ruby

John K

3/7/2006 3:45:00 PM

Beginner's question: I'm creating a large C array using ALLOC_N and I
want to pass that pointer to different C extensions. I don't want to
create a Ruby array (i.e. using rb_ary_new4()) because I won't operate
on that array with any pure Ruby methods and I don't want the memcpy
overhead. How can I assign a variable to that pointer in Ruby and how
do I prevent any garbage collection of my array?

--
Posted via http://www.ruby-....


1 Answer

Timothy Goddard

3/8/2006 11:25:00 AM

0

http://www.whytheluckystiff.net/ruby/pickaxe/html/ext...

This explains how to use Data_Wrap_Struct and how to manage garbage
collection. The issue is not so much preventing garbage collection as
making it possible.