<nobu / ruby-lang.org> wrote:

> 
> All arguments are passed as VALUE, not C type.
> 
> VALUE method_raliasfile_init(VALUE self, VALUE alias_path)
> {
>     rb_iv_set(self, "@alias_path", alias_path);
>     return self;
> }

then this arg "VALUE alias_path" will be common to all of the methods i
have ?

it seems not (???)

i've change my init for debugg purpose to :


VALUE m_raliasfile_init(VALUE self, VALUE alias_path)
{
printf("m_raliasfile_init");
printf((char *)alias_path);
printf("alias_path");
  rb_iv_set(self, "@alias_path", alias_path);
  return self;
}


and, when i use my class from ruby i do :

a=RAliasFile.new("/Users/yvon/work/Ruby/Native/C/doc/Introduction_ANSI_C
_html")
puts a.alias_path

the print out (from C) being :

m_raliasfile_initalias_path

which means the arg "alias_path" isn't pass to "m_raliasfile_init"

the ruby line "puts a.alias_path" gives :

ArgumentError: NULL pointer given

where the C counterpart being :
VALUE m_alias_path(VALUE self) {
//  char *alias_path = "/path/to/something/undefined";
  return rb_str_new2((char *) alias_path);
}


what i want is my class "RAliasFile" being initialize like that (from
ruby) :

a=RAliasFile.new("/Users/yvon/work/Ruby/Native/C/doc/Introduction_ANSI_C
_html")

the parameter of "new" being alias_path bar in the C counterpart...

i'm a newb in C as you can see, that's (will be) my first extension..
-- 
une bue