From: unbewust Date: 2007-08-07T21:59:58+09:00 Subject: [C ext to Ruby] how to scan a RARRAY ??? from ruby.h : struct RArray { struct RBasic basic; long len; union { long capa; VALUE shared; } aux; VALUE *ptr; }; my module make use of : VALUE m_set_icon(VALUE self, VALUE src_path, VALUE dst_pathes[]) dst_pathes is a T_ARRAY int len = RARRAY(dst_pathes)->len; printf("len = %d\n", len); char *cdst_pathes[len]; how to duplicated the VALUE (shared) from the struct RArray into cdst_pathes (an Array of char *) ??? i don't see how to use the VALUE *ptr, ie. in my case : RARRAY(dst_pathes)->ptr ruby side : require 'rseticon' include RSetIcon puts "RSetIcon : version = " + version() puts "RSetIcon : set_icon(\"aIcon.icns\", [\"un\", \"deux\", \"trois \"]) = " + set_icon("aIcon.icns", ["un", "deux", "trois"]).to_s gives the obvious result : [un, deux, trois]. "un", "deux", "trois" will be the pathes of files where we want to apply the icon "aIcon.icns" (first arg of set_icon). then, i want to retrieve, in the C side as a CString the pathes where to apply the icon. i don't see how to use RARRAY(dst_pathes)->ptr to scan the VALUEs (in the union aux) ??? thanks in advance ;-) Yvon