Commits

ariovistus committed d586e24

Edited online

Comments (0)

Files changed (1)

 Exposing D functions to Python is easy! The heart of Pyd's function wrapping features is the def template function:
 {{{
 #!d
-void def(alias fn, char[] name = symbolnameof!(fn), fn_t = typeof(&fn), uint MIN_ARGS = minArgs!(fn)) (string docstring="");
+void def(alias fn, 
+         string name = symbolnameof!(fn), 
+         fn_t = typeof(&fn), 
+         uint MIN_ARGS = minArgs!(fn)) 
+        (string docstring="");
+void def(string modulename, 
+         alias fn, 
+         string name = symbolnameof!(fn), 
+         fn_t=typeof(&fn), 
+         uint MIN_ARGS = minArgs!(fn, fn_t)) 
+        (string docstring) 
 }}}
-
+* **modulename** is the name of the python module in which the wrapped function resides.
 * **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.)