aboutsummaryrefslogtreecommitdiff
path: root/Examples/test-suite/nested_structs.i
diff options
context:
space:
mode:
Diffstat (limited to 'Examples/test-suite/nested_structs.i')
-rw-r--r--Examples/test-suite/nested_structs.i16
1 files changed, 16 insertions, 0 deletions
diff --git a/Examples/test-suite/nested_structs.i b/Examples/test-suite/nested_structs.i
index c15623085..44ff994ba 100644
--- a/Examples/test-suite/nested_structs.i
+++ b/Examples/test-suite/nested_structs.i
@@ -25,5 +25,21 @@ void setValues(struct Outer *outer, int val) {
outer->inside4[0].val = val * 4;
outer->inside5 = &outer->inside3;
}
+
+int getInside1Val(struct Outer *n) { return n->inside1.val; }
+%}
+
+/*
+Below was causing problems in Octave as wrappers were compiled as C++.
+Solution requires regenerating the inner struct into
+the global C++ namespace (which is where it is intended to be in C).
+*/
+%inline %{
+int nestedByVal(struct Named s);
+int nestedByPtr(struct Named *s);
+%}
+%{
+int nestedByVal(struct Named s) { return s.val; }
+int nestedByPtr(struct Named *s) { return s->val; }
%}