From: Tony Smith Date: 2002-02-07T21:44:01+09:00 Subject: Re: API questions Andy Neagu wrote: > Hi everybody, > > > I'm working on an extension to ruby that will allow me to work directly > with Orca (a dll that allows you to work directly with pbls - Powerbuilder > libraries). I'm not familiar with the ruby API's and I have some problems > (like documentation I'm using "Programming Ruby"). > > > Then: > > How can I know the size of an ruby array? The same way you would if you were using Ruby. i.e. call Array#length. NUM2INT( rb_funcall( ary, rb_intern( "length" ), 0 ) ) > STR2CSTR makes a copy? Or gets only a pointer to? Looks like it gets a pointer to the C string. > If I want to pass to a function a pointer array of C strings and the > strings are in a ruby array of strings, how can I do?? You have to build the C array dynamically. I'd call Array#flatten() in case any of the members of the array are arrays themselves. Then allocate a C array of the appropriate length, and populate it from the flattened ruby array. Tony -- Tony Smith tony at perforce dot com