>>>>> "C" == C Grierson <cbgb / u.washington.edu> writes:

C> i hope i'm not being a complete list newbie, but i was wondering if
C> anyone could share any resources for programming in the C API.  i
C> managed to write a cracklib interface class, but i realized i don't
C> know how to deal with variable arguments and my 'initialize' insists
C> on one parameter.

 Well, you have in README.EXT

 ------------------------------------------------------------

** Method Definition

 rb_define_method(VALUE klass, const char *name, VALUE (*func)(), int argc)

Defines a method for the class.  func is the function pointer.  argc
is the number of arguments.  if argc is -1, the function will receive
3 arguments argc, argv, and self.  if argc is -2, the function will
receive 2 arguments, self and args, where args is the Ruby array of
the method arguments.

 ------------------------------------------------------------


 This mean that you can write

   static VALUE
   tt_init(argc, argv, obj)
       int argc;
       VALUE *argv, obj;
   {
   }

 ...

   rb_define_method(tt_cTT, "initialize", tt_init, -1);

 ...


 when tt_init() is called argc is the number of arguments given to it.


Guy Decoux