Thanks for your help, Charlie.

Charlie Mills wrote:
> In short:
> rb_exc_raise(my_err_new(eno));

Took me a minute to find that... it's in intern.h, can I call those
functions, I mean, should I?

Looking through that code, it seems my only option is to create the
object myself, then call this internal function.

Looks like it will work fine, but is this really recommended?

Daniel wrote:
> Doesn't rb_sys_fail(0) work for this scenario?  I thought if a C
> function failed, you could call rb_sys_fail(0) and it would raise the
> appropriate Errno.  Or am I confused?

I didn't know about this function, but no, its not for me.

It only makes sense if the C function you are calling is returning a
system error number, i.e. from <errno.h>.

For example, when a C function in our library returns 9, it means "index
out of bounds", but when a system call returns 9 it means bad file
descriptor, and when the Crypoki API (random example) returns 9 it means
CKR_NEED_TO_CREATE_THREADS.

I wouldn't want to return Errno::EBADF from my wrapper when the error is
index out of bounds!

Charlie wrote:
> Yeah that works too, if your using the standard library functions.  I
> thought from the OP that the error numbers he was working with were not
> related to those used by the std lib, but I may be wrong.

Nope, bang on.

Sam

-- 
http://www.certicom.com