From: Clemens Hintze Date: 2000-03-16T19:36:34+01:00 Subject: [ruby-talk:01921] Re: object creation Yukihiro Matsumoto writes: > > 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: > Perhaps I have misunderstood Andy, but I thought he suppose to have a class MD5 that already exists as e.g. extension. But it has no e.g. rb_md5_new function serving as C constructor like all built-in classes of Ruby have! In another extension, he wants to create an instance of just this MD5 class on C level. I have already send an answer for that case. If I was wrong, however, please ignore my sermon :-) ... > matz. \cle -- Clemens Hintze mailto: c.hintze@gmx.net