/trunk/Examples/java/funcptr/example.i

# · Swig · 16 lines · 9 code · 4 blank · 3 comment · 0 complexity · 53fa3de256346426072daa7f5e1e1d2a MD5 · raw file

  1. /* File : example.i */
  2. %module example
  3. %{
  4. #include "example.h"
  5. %}
  6. /* Wrap a function taking a pointer to a function */
  7. extern int do_op(int a, int b, int (*op)(int, int));
  8. /* Now install a bunch of "ops" as constants */
  9. %constant int (*ADD)(int,int) = add;
  10. %constant int (*SUB)(int,int) = sub;
  11. %constant int (*MUL)(int,int) = mul;
  12. extern int (*funcvar)(int,int);