PageRenderTime 5ms CodeModel.GetById 1ms app.highlight 1ms RepoModel.GetById 1ms app.codeStats 1ms

/trunk/Examples/test-suite/argout.i

#
Swig | 37 lines | 27 code | 7 blank | 3 comment | 0 complexity | b278978afa081ce59be238691fb089ef MD5 | raw file
 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
12int incp(int *value) {
13  return (*value)++;
14}
15
16// returns old value
17int incr(int &value) {
18  return value++;
19}
20
21typedef int & IntRef;
22// returns old value
23int 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**
30void voidhandle(void** handle) {
31  *handle=(void*)"Here it is";
32}
33char * handle(void* handle) {
34  return (char *)handle;
35}
36
37%}