diff options
Diffstat (limited to 'Examples/python/funcptr/example.i')
-rw-r--r-- | Examples/python/funcptr/example.i | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/Examples/python/funcptr/example.i b/Examples/python/funcptr/example.i new file mode 100644 index 0000000..8b3bef6 --- /dev/null +++ b/Examples/python/funcptr/example.i @@ -0,0 +1,16 @@ +/* File : example.i */ +%module example +%{ +#include "example.h" +%} + +/* Wrap a function taking a pointer to a function */ +extern int do_op(int a, int b, int (*op)(int, int)); + +/* Now install a bunch of "ops" as constants */ +%constant int (*ADD)(int,int) = add; +%constant int (*SUB)(int,int) = sub; +%constant int (*MUL)(int,int) = mul; + +extern int (*funcvar)(int,int); + |