PageRenderTime 54ms CodeModel.GetById 22ms RepoModel.GetById 1ms app.codeStats 0ms

/tags/rel-1.3.35/Examples/ruby/funcptr/example.i

#
Swig | 15 lines | 8 code | 4 blank | 3 comment | 0 complexity | c588f39d9ea6bdedd0d408f877d42561 MD5 | raw file
Possible License(s): LGPL-2.1, Cube, GPL-3.0, 0BSD, GPL-2.0
  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;