Skip to content

__ref__,__deref__ handling #97

@KrisThielemans

Description

@KrisThielemans

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions