From de6d4f7e7bdb78e5cb443a2e327265b52cde0d44 Mon Sep 17 00:00:00 2001 From: drbrain Date: Tue, 16 Aug 2011 00:34:51 +0000 Subject: * 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 --- ext/dl/cfunc.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'ext/dl/cfunc.c') 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) + * => # + * @cfunc = DL::CFunc.new(libc,['strcpy'], DL::TYPE_VOIDP, '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); -- cgit v1.2.3