From: matz@... (Yukihiro Matsumoto) Date: 2000-03-17T02:17:05+09:00 Subject: [ruby-talk:01912] Re: object creation In message "[ruby-talk:01894] Re: object creation" on 00/03/16, Andrew Hunt writes: | >Yes. But I think it's better for T_DATA object to use | >Data_Make_Struct/Data_Wrap_Struct, as Clemens stated. | |Agreed, but here's my real question: suppose you have a non-built- |in class such as MD5, which does not expose a C-level constructor |(something like rb_str_new, rb_time_new, etc). What is the |preferred way to create a new MD5 object from C code? I haven't settled my mind yet about this. If you want to preserve `initialize' behavior, here's the way: a) in `new': obj = Data_Wrap_Struct(klass, mark, free, 0); rb_obj_call_init(obj, argc, argv); b) in `initialize' ... you may destroy previous non null DATA_PTR(obj) ... DATA_PTR(obj) = allocated struct. matz.