[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

at_exit in C extension

Jan Dvorak

12/17/2007 12:30:00 PM

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

2 Answers

Paul Brannan

12/17/2007 4:49:00 PM

0

On Mon, Dec 17, 2007 at 09:29:53PM +0900, Jan Dvorak 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


Jan Dvorak

12/17/2007 10:11:00 PM

0

On Monday 17 December 2007 17:49:19 Paul Brannan 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