At_exit in C extension

Hello,

For ruby 1.8 i used registering at_exit in C via eval (quite hackish i
know)
as in:

void Init_Mymodule()
{

module = rb_define_module(“Mymodule”);
rb_define_module_function(module,“myfunc”, …

rb_eval_string(“at_exit do Mymodule.myfunc end”);
}

but that doesn’t work with 1.9/head anymore (crash). However when i move
the
at_exit call to the ruby script which uses the extension, it works just
fine.
So, what is the correct way of using at_exit for C extension function ?

Thanks,
Jan

On Mon, Dec 17, 2007 at 09:29:53PM +0900, Jan D. wrote:

So, what is the correct way of using at_exit for C extension function ?

Usually I use rb_set_end_proc().

Still, what you wrote shouldn’t crash. Have you submitted a bug report?

Paul

On Monday 17 December 2007 17:49:19 Paul B. wrote:

Usually I use rb_set_end_proc().
That worked fine, thanks.

Still, what you wrote shouldn’t crash. Have you submitted a bug report?
I just did.

Thanks again,
Jan

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs