new example
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@841 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
52386c6406
commit
92093ca12d
6 changed files with 134 additions and 13 deletions
15
Examples/python/funcptr/example.i
Normal file
15
Examples/python/funcptr/example.i
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
/* 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 (*)(int,int)) ADD = add;
|
||||
%constant(int (*)(int,int)) SUB = sub;
|
||||
%constant(int (*)(int,int)) MUL = mul;
|
||||
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue