Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   Ruby (http://www.velocityreviews.com/forums/f66-ruby.html)
-   -   pointer to c array in Ruby (http://www.velocityreviews.com/forums/t829311-pointer-to-c-array-in-ruby.html)

John K 03-07-2006 03:45 PM

pointer to c array in Ruby
 
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-forum.com/.



Timothy Goddard 03-08-2006 11:25 AM

Re: pointer to c array in Ruby
 
http://www.whytheluckystiff.net/ruby.../ext_ruby.html

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.



All times are GMT. The time now is 06:01 PM.

Powered by vBulletin®. Copyright ©2000 - 2013, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57