Thank you, the key part I was missing was the check_rstruct_data.
That's why I could not understand the RHASH, RSTRING, etc. conversions.
> RHASH: I didn't got into details but it looks like hash_table members
> aren't the same as MRI st_table, this could break stuff. Also you should
> follow the same R* pattern, saving the struct instance on
> rni_handle->data and copying back data to subtend later. The way it is
> now it will leak tons of memory since each call to RHASH will
> instantiate a new RHash that will never get freed.
True, but now I have the information to fix it. Thanks. :) There's no
doubt that my implementation wasn't the same as MRI's. It would have
worked (for a limited definition of "work") for the extensions I was
testing, but I'll get a more complete implementation that should work
for other extensions.
> Good luck, and keep hacking! :)
Thank you very much for your comments. The check_rstruct_data is what
was eluding me, and this area has now snapped into clear focus. :) I
really appreciate your feedback.
There's a new version of this patch, for anyone who cares to look, at:
http://users.nexopia.com/uploads/3233/3233577/rubinius/RMI-extension.patch
I believe I addressed all the issues that Cezar raised. I'll most
likely commit this tomorrow. Any remaining issues, and there may well
be some, I'll most likely track down as I start debugging issues with
Rubinius running the Nexopia ruby code. I already have found some MRI
incompatibilities in the language itself and I'm quite sure the gem
extensions will also break things.
As to the hash table, I decided to copy in MRI's st.h and st.c. It
seemed to be the easiest approach.