From: Joe Van Dyk Date: 2005-04-05T03:55:02+09:00 Subject: Re: Extension question On Apr 4, 2005 8:34 AM, Charles Mills wrote: > > > Are there any general rules of thumb that you use when writing > extensions? > > http://www.ruby-talk.org/cgi-bin/scat.rb/ruby/ruby-talk/47700 > > You shouldn't be able to cause your extension to seg fault from Ruby. > That may sound like a joke, but I just mean using StringValue, > NUM2LONG, etc before you starting using Ruby objects in C. How should errors be handled in C extensions? For example, my C extension was expecting a Ruby string, but it was passed an IO object. Or, what should I do when I try to open a file in C (the filename being passed to the function) and the file doesn't exist?