import source from 1.3.40
[external/swig.git] / Examples / test-suite / argout.i
1 /* This interface file checks how well SWIG handles passing data back
2    through arguments WITHOUT returning it separately; for the cases where
3    maybe multiple values are passed by reference and all want changing */
4
5 %module argout
6
7 %include cpointer.i
8 %pointer_functions(int,intp);
9
10 %inline %{
11 // returns old value
12 int incp(int *value) {
13   return (*value)++;
14 }
15
16 // returns old value
17 int incr(int &value) {
18   return value++;
19 }
20
21 typedef int & IntRef;
22 // returns old value
23 int inctr(IntRef value) {
24   return value++;
25 }
26
27 // example of the old DB login type routines where you keep
28 // a void* which it points to its opaque struct when you login
29 // So login function takes a void**
30 void voidhandle(void** handle) {
31   *handle=(void*)"Here it is";
32 }
33 char * handle(void* handle) {
34   return (char *)handle;
35 }
36
37 %}