C nested struct passed by value example
This was causing problems in Octave as wrappers were compiled as C++. Solution has already been committed and required regenerating the inner struct into the global C++ namespace (which is where it is intended to be in C).
This commit is contained in:
parent
1c7054b98a
commit
19f202cc16
1 changed files with 14 additions and 0 deletions
|
|
@ -25,3 +25,17 @@ void setValues(struct Outer *outer, int 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; }
|
||||||
|
%}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue