swig icon indicating copy to clipboard operation
swig copied to clipboard

Add support for directors

Open jgillis opened this issue 9 years ago • 10 comments

jgillis avatar Jun 30 '15 15:06 jgillis

thanks for this. I have a few compilation errors when running the test-suite. One of this is related to the fact that you're calling error() (3 times, e.g. in wrapConstructor). However, that's an Octave function that doesn't exist in MATLAB. I no longer get compilation errors when using

mexErrMsgIdAndTxt("SWIG:RuntimeError",errortext);

but I'm not 100% sure if this is what is needed. What do you think?

KrisThielemans avatar Aug 27 '15 14:08 KrisThielemans

apologies. The code in wrapConstructor was fine. This error is only in MATLAB::MATLAB when writing to the director_prot_ctor_code (L272 of matlab.cxx)

KrisThielemans avatar Aug 27 '15 18:08 KrisThielemans

I've now commited this and one other fix in my fork. The other fix adds some "const" to member functions. This now makes quite a lot more test cases compile (and a few more run...).

you can find it on

https://github.com/KrisThielemans/swig/tree/director_fixes

Sadly, I'm still not used to pull requests, so this branch also contains updates from Pull Request #41

KrisThielemans avatar Aug 27 '15 23:08 KrisThielemans

I've pulled your changes. @jgillis - close?

jaeandersson avatar Aug 28 '15 10:08 jaeandersson

thanks! There's still quite a lot of failures in the test-suite related to directors. And @jgillis mentioned a memory leak. So I guess we cannot close this issue yet?

KrisThielemans avatar Aug 28 '15 10:08 KrisThielemans

Looks like directors now only work when there is exactly one output. I tried to use it with a function with void return and it failed.

jaeandersson avatar Oct 06 '15 05:10 jaeandersson

The director code really needs cleanup for maintainability.

jaeandersson avatar Oct 06 '15 05:10 jaeandersson

Design can be refactored using mxCalloc/mexMakeMemoryPersistent

jgillis avatar Dec 27 '16 08:12 jgillis

Interesting. Will you take a shot at it?

jaeandersson avatar Dec 27 '16 09:12 jaeandersson

Most of the director support seems to work, but there are still 2 failures after #96.

KrisThielemans avatar Aug 01 '21 20:08 KrisThielemans