diff options
| author | Lorry Tar Creator <lorry-tar-importer@baserock.org> | 2009-08-18 20:56:02 +0000 |
|---|---|---|
| committer | Lorry <lorry@roadtrain.codethink.co.uk> | 2012-09-25 16:59:08 +0000 |
| commit | 9f8a09ed743cedd9547bf0661d518647966ab114 (patch) | |
| tree | 9c7803d3b27a8ec22e91792ac7f7932efa128b20 /Examples/test-suite/pointer_reference.i | |
| download | swig-tarball-master.tar.gz | |
Imported from /srv/lorry/lorry-area/swig-tarball/swig-1.3.40.tar.gz.HEADswig-1.3.40master
Diffstat (limited to 'Examples/test-suite/pointer_reference.i')
| -rw-r--r-- | Examples/test-suite/pointer_reference.i | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/Examples/test-suite/pointer_reference.i b/Examples/test-suite/pointer_reference.i new file mode 100644 index 0000000..b7c6054 --- /dev/null +++ b/Examples/test-suite/pointer_reference.i @@ -0,0 +1,44 @@ +/* This interface file tests whether SWIG handles pointer-reference + (*&) arguments. + + SWIG 1.3a5 signals a syntax error. +*/ + +%module pointer_reference + +%warnfilter(SWIGWARN_TYPEMAP_SWIGTYPELEAK); /* memory leak when setting a ptr/ref variable */ + +#ifdef SWIGGUILE +/* A silly testing typemap for feeding a doubly indirect integer */ +%typemap(in) int *&XYZZY (int temp1, int *temp2) { + temp1 = gh_scm2int($input); temp2 = &temp1; $1 = &temp2; +}; +#endif + +%inline %{ +void foo(int *&XYZZY) {} +%} + + +// Test pointer reference typemaps shipped with SWIG (add in SWIG 1.3.28 for many languages) +%inline %{ +struct Struct { + int value; + Struct(int v) : value(v) {} + static Struct instance; + static Struct *pInstance; +}; + +void set(Struct *& s) { + Struct::instance = *s; +} +Struct *& get() { + return Struct::pInstance; +} +%} + +%{ +Struct Struct::instance = Struct(10); +Struct *Struct::pInstance = &Struct::instance; +%} + |
