Add pointer reference for runtime testing
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@8065 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
a87acb5aa3
commit
4326e443b7
1 changed files with 24 additions and 0 deletions
|
|
@ -16,3 +16,27 @@
|
||||||
%inline %{
|
%inline %{
|
||||||
void foo(int *&XYZZY) {}
|
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;
|
||||||
|
%}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue