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

Explicitly print a warning about missing support for save/load #59

Open
traversaro opened this issue Sep 16, 2015 · 4 comments
Open

Explicitly print a warning about missing support for save/load #59

traversaro opened this issue Sep 16, 2015 · 4 comments

Comments

@traversaro
Copy link

I got some feedback from confused users of my SWIG-wrapped library that saved (with "save") and loaded back (with "load") their workspace containing SWIG Classes.

Clearly the "save" and "load" are not supported out-of-the-box by the SWIG Classes. The main source of confusion is that the class are saved and loaded without any warning, and then they fail with an error message when the user interacts with the loaded classes.

To have a clearer error message, I tried to implement a saveobj method in SwigRef that just print a warning as soon as the user try to save a SWIG class, but I don't know if it could make sense to have this in the SwigRef.m generated by SWIG.

@jaeandersson
Copy link
Owner

Good point. It makes sense to implement this method only to ensure that an error is being thrown.

@traversaro
Copy link
Author

Fixed by 76e657b ?

@jaeandersson
Copy link
Owner

@jgillis ?

@KrisThielemans
Copy link

we currently have this
https://github.com/KrisThielemans/swig/blob/cecdea3f44837ce95bdf1fef809312f2e786c08b/Source/Modules/matlab.cxx#L2748-L2751
This gives however

warning: Serializing SWIG objects not supported.
warning: called from
    saveobj at line 16 column 7

error: saveobj: not defined for class "char"
error: called from
    saveobj at line 51 column 3
    saveobj at line 17 column 11

which isn't great either. I think better to call error directly

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

3 participants