summaryrefslogtreecommitdiff
path: root/ext/dl/cfunc.c
diff options
context:
space:
mode:
authordrbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-08-16 00:34:51 +0000
committerdrbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-08-16 00:34:51 +0000
commitde6d4f7e7bdb78e5cb443a2e327265b52cde0d44 (patch)
tree7252478a71b4a14c2d8f594aaed1ce0757129a85 /ext/dl/cfunc.c
parent87ff4b24ae4911bda46a5426024959c278da69b2 (diff)
* 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.c28
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);