From: Sam Roberts Date: 2005-05-20T00:16:08+09:00 Subject: Re: howto make something like Errno::##, for my C ext, or do I need to? Wrote Charles Mills , on Thu, May 19, 2005 at 07:30:13AM +0900: > Sam Roberts wrote: > > Looks like it will work fine, but is this really recommended? > > It is fine. You also need to create your error class: > class MyErr < StandardError; end # or in C: > eMyError = rb_define_class("MyError", rb_eStandardError); > > Then you can define an accessor in Ruby or in C: > attr_reader :eno > rb_define_attr(eMyError, "eno", 1, 0); > > I wouldn't worry about writing an init function if your only going to > be raising these errors from C. Worked like a charm, thanks a bunch. Sam -- http://www.certicom.com