at_exit in C extension

J

Jan Dvorak

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
 
P

Paul Brannan

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,764
Messages
2,569,564
Members
45,039
Latest member
CasimiraVa

Latest Threads

Top