diff options
author | drbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2011-08-16 00:34:51 +0000 |
---|---|---|
committer | drbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2011-08-16 00:34:51 +0000 |
commit | de6d4f7e7bdb78e5cb443a2e327265b52cde0d44 (patch) | |
tree | 7252478a71b4a14c2d8f594aaed1ce0757129a85 /ext/dl/cfunc.c | |
parent | 87ff4b24ae4911bda46a5426024959c278da69b2 (diff) | |
download | ruby-de6d4f7e7bdb78e5cb443a2e327265b52cde0d44.tar.gz |
* ext/dl: Add documentation. Patch by Vincent Batts. [Ruby 1.9 - Bug #5192]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32982 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/dl/cfunc.c')
-rw-r--r-- | ext/dl/cfunc.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/ext/dl/cfunc.c b/ext/dl/cfunc.c index f076c6f432..66aebf2e79 100644 --- a/ext/dl/cfunc.c +++ b/ext/dl/cfunc.c @@ -620,10 +620,38 @@ Init_dlcfunc(void) #if defined(_WIN32) id_win32_last_error = rb_intern("__DL2_WIN32_LAST_ERROR__"); #endif + + /* + * Document-class: DL::CFunc + * + * A direct accessor to a function in a C library + * + * == Example + * + * libc_so = "/lib64/libc.so.6" + * => "/lib64/libc.so.6" + * libc = DL::dlopen(libc_so) + * => #<DL::Handle:0x00000000e05b00> + * @cfunc = DL::CFunc.new(libc,['strcpy'], DL::TYPE_VOIDP, 'strcpy') + * => #<DL::CFunc:0x000000012daec0 ptr=0x007f62ca5a8300 type=1 name='strcpy'> + * + */ rb_cDLCFunc = rb_define_class_under(rb_mDL, "CFunc", rb_cObject); rb_define_alloc_func(rb_cDLCFunc, rb_dlcfunc_s_allocate); + + /* + * Document-method: last_error + * + * Returns the last error for the current executing thread + */ rb_define_module_function(rb_cDLCFunc, "last_error", rb_dl_get_last_error, 0); #if defined(_WIN32) + + /* + * Document-method: win32_last_error + * + * Returns the last win32 error for the current executing thread + */ rb_define_module_function(rb_cDLCFunc, "win32_last_error", rb_dl_get_win32_last_error, 0); #endif rb_define_method(rb_cDLCFunc, "initialize", rb_dlcfunc_initialize, -1); |