PageRenderTime 49ms CodeModel.GetById 23ms RepoModel.GetById 1ms app.codeStats 0ms

/tags/rel-1-3-26/SWIG/Examples/lua/pointer/example.i

#
Swig | 28 lines | 11 code | 11 blank | 6 comment | 0 complexity | b6b01301c0dff5d57425589a832676f7 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 <stdlib.h>
  5. %}
  6. /* This example illustrates a couple of different techniques
  7. for manipulating C pointers */
  8. /* First we'll use the pointer library */
  9. extern void add(int *x, int *y, int *result);
  10. %include cpointer.i
  11. %pointer_functions(int, intp);
  12. /* Next we'll use some typemaps */
  13. %include typemaps.i
  14. extern void sub(int *INPUT, int *INPUT, int *OUTPUT);
  15. /* Next we'll use typemaps and the %apply directive */
  16. %apply int *OUTPUT { int *r };
  17. extern int divide(int n, int d, int *r);