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:
William S Fulton 2013-11-30 18:01:24 +00:00
parent 1c7054b98a
commit 19f202cc16
1 changed files with 14 additions and 0 deletions

View File

@ -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; }
%}