diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-03-03 06:40:40 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-03-03 06:40:40 +0000 |
commit | 1001173ccd68f728d28cf7fb8752326bc3ddf3eb (patch) | |
tree | 49bf7963d93ebb19a412d74edc7d78d119a8c62f /ext/dl/dl.c | |
parent | 2233d34b39c491d3930ad3a5e970200b6d43c32d (diff) | |
download | ruby-1001173ccd68f728d28cf7fb8752326bc3ddf3eb.tar.gz |
* ext/dl/dl.c (rb_dl_init_callbacks): autoloads callbacks.
* ext/dl/callback: split from dl.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22722 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/dl/dl.c')
-rw-r--r-- | ext/dl/dl.c | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/ext/dl/dl.c b/ext/dl/dl.c index 0427dfb3f3..984a62a7ef 100644 --- a/ext/dl/dl.c +++ b/ext/dl/dl.c @@ -60,7 +60,18 @@ rb_dl_value2ptr(VALUE self, VALUE val) return PTR2NUM((void*)val); } -#include "callback.h" +static void +rb_dl_init_callbacks(VALUE dl) +{ + static const char cb[] = "dl/callback.so"; + + rb_autoload(dl, rb_intern_const("CdeclCallbackAddrs"), cb); + rb_autoload(dl, rb_intern_const("CdeclCallbackProcs"), cb); +#ifdef FUNC_STDCALL + rb_autoload(dl, rb_intern_const("StdcallCallbackAddrs"), cb); + rb_autoload(dl, rb_intern_const("StdcallCallbackProcs"), cb); +#endif +} void Init_dl() @@ -69,8 +80,8 @@ Init_dl() void Init_dlcfunc(); void Init_dlptr(); - rbdl_id_cdecl = rb_intern("cdecl"); - rbdl_id_stdcall = rb_intern("stdcall"); + rbdl_id_cdecl = rb_intern_const("cdecl"); + rbdl_id_stdcall = rb_intern_const("stdcall"); rb_mDL = rb_define_module("DL"); rb_eDLError = rb_define_class_under(rb_mDL, "DLError", rb_eStandardError); @@ -79,7 +90,7 @@ Init_dl() rb_define_const(rb_mDL, "MAX_CALLBACK", INT2NUM(MAX_CALLBACK)); rb_define_const(rb_mDL, "DLSTACK_SIZE", INT2NUM(DLSTACK_SIZE)); - rb_dl_init_callbacks(); + rb_dl_init_callbacks(rb_mDL); rb_define_const(rb_mDL, "RTLD_GLOBAL", INT2NUM(RTLD_GLOBAL)); rb_define_const(rb_mDL, "RTLD_LAZY", INT2NUM(RTLD_LAZY)); |