Files changed (1)
+Exposing D functions to Python is easy! The heart of Pyd's function wrapping features is the def template function:
+void def(alias fn, char name = symbolnameof!(fn), fn_t = typeof(&fn), uint MIN_ARGS = minArgs!(fn)) (char docstring="");
+* **fn** is the function to wrap. Note that this is an alias parameter. def is only capable of wrapping full-fledged functions, not function pointers, function literals, or delegates.
+* **name** is the name the function will have inside of Python. Usually, you don't have to specify this. (Special thanks to Don Clugston's Nameof module.)
+* **fn_t** is the function type of the function. Typically, you won't have to specify this. It is used to wrap overloaded functions. (See below.)
+* **MIN_ARGS** is the minimum number of arguments this function can accept. It is used when a function has default arguments. The minArgs template can derive the correct number automatically, so you typically won't specify this manually.
+All calls to def must occur before calling module_init. Any function whose return type and arguments are convertible can be wrapped by def. def can only wrap functions with in arguments (not out or ref or lazy). def also provides support for wrapping overloaded functions as well as functions with default arguments. Here are some examples: