name | The name of the function as it will appear in Python. |
fn | The function to wrap. |
MIN_ARGS | The minimum number of arguments this function can accept. For use with functions with default arguments. Defaults to the maximum number of arguments this function supports. |
fn_t | The function type of the function to wrap. This must be specified if more than one function shares the same name, otherwise the first one defined lexically will be used. |
import pyd.pyd; char[] foo(int i) { if (i > 10) { return "It's greater than 10!"; } else { return "It's less than 10!"; } } extern (C) export void inittestdll() { def!("foo", foo); module_init("testdll"); }And in Python:
>>> import testdll >>> print testdll.foo(20) It's greater than 10!