Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // The 'rb_define_global_function' can be found in class.c
- /*!
- * Defines a global function
- * \param name name of the function
- * \param func the method body
- * \param argc the number of parameters, or -1 or -2. see \ref defmethod.
- */
- void
- rb_define_global_function(const char *name, VALUE (*func)(ANYARGS), int argc)
- {
- rb_define_module_function(rb_mKernel, name, func, argc);
- }
- // As you can see, this just defines a method on the "Kernel"-Module (which is defined in object.c)
- /*!
- * Defines a module function for \a module.
- * \param module an module or a class.
- * \param name name of the function
- * \param func the method body
- * \param argc the number of parameters, or -1 or -2. see \ref defmethod.
- */
- void
- rb_define_module_function(VALUE module, const char *name, VALUE (*func)(ANYARGS), int argc)
- {
- rb_define_private_method(module, name, func, argc);
- rb_define_singleton_method(module, name, func, argc);
- }
Add Comment
Please, Sign In to add comment