Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

__ref__,__deref__ handling #97

Open
KrisThielemans opened this issue Aug 1, 2021 · 0 comments
Open

__ref__,__deref__ handling #97

KrisThielemans opened this issue Aug 1, 2021 · 0 comments

Comments

@KrisThielemans
Copy link

swig/Lib/swig.swg

Lines 426 to 428 in cd3f6c5

%rename(__deref__) *::operator->;
%rename(__ref__) *::operator*();
%rename(__ref__) *::operator*() const;

needs to be changed for MATLAB, as it doesn't allow functions starting with _. This creates an error in the test-suite

ERROR: Error: File: /home/kthielem/devel/build/swig/Examples/test-suite/matlab/+smart_pointer_member/Bar.m Line: 17 Column: 26
Invalid text character. Check for unsupported symbol, invisible character, or pasting of non-ASCII characters.
   smart_pointer_member failed

That seems trivial, but then the question is what to do with them... Octave has

%typemap(ret) const SWIGTYPE & SMARTPOINTER, SWIGTYPE SMARTPOINTER {
octave_swig_type* lobj=Swig::swig_value_deref($result);
if (lobj) {
std::list<octave_value_list> idx;
idx.push_back(octave_value("__deref__"));
idx.push_back(octave_value_list());
octave_value_list ovl(lobj->subsref(".(",idx));
octave_swig_type* robj=ovl.length()>=1?Swig::swig_value_deref(ovl(0)):0;
if (robj && !error_state)
lobj->append(robj);
}

which might be related? Maybe not as this is stuff with SMARTPOINTER, which we currently don't have in the Matlab module.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant