Discussion:
[Swig-devel] [MATLAB] How to manipulate wrappers for constructor?
Joel Andersson
2015-08-29 10:56:53 UTC
Permalink
Hi!

I'm back working on the MATLAB module. Thanks to everybody's help, I think
we are very close to having an essentially feature complete module. After
debugging the existing features and writing documentation, we should be
ready for a code review.

I'm now trying to wrap up the support for multiple modules (lots of cred
goes to Don Bigler) and clean up the handling of pointers.

An issue I have is that the wrapped constructor of a class is called from
the constructor of the MATLAB proxy class. That is, when calling the
constructor, the proxy class has already been created. But, as it works
now, the wrapped constructor will try to return a new proxy class instance.

Another way to explain it: Currently, the wrapper of the constructor will
work something like:

foo_proxy = _wrap_new_Foo(constructor_arguments)

But instead I want the proxy class to look like:

_wrap_new_Foo(foo_proxy, constructor_arguments)

How can I change the wrapping of constructors this way?

Best regards,
Joel
--
--
Joel Andersson, PhD
Ptge. Busquets 11-13, atico 3
E-08940 Cornella de Llobregat (Barcelona), Spain
Home: +34-93-6034011
Mobile: +34-63-4408800 (in Sweden also +46-707-360512)
William S Fulton
2015-08-29 12:36:54 UTC
Permalink
Post by Joel Andersson
Hi!
I'm back working on the MATLAB module. Thanks to everybody's help, I think
we are very close to having an essentially feature complete module. After
debugging the existing features and writing documentation, we should be
ready for a code review.
I'm now trying to wrap up the support for multiple modules (lots of cred
goes to Don Bigler) and clean up the handling of pointers.
An issue I have is that the wrapped constructor of a class is called from
the constructor of the MATLAB proxy class. That is, when calling the
constructor, the proxy class has already been created. But, as it works now,
the wrapped constructor will try to return a new proxy class instance.
Another way to explain it: Currently, the wrapper of the constructor will
foo_proxy = _wrap_new_Foo(constructor_arguments)
I'm pretty sure all the language modules work like this, ie a new
proxy is created for every pointer obtained from C/C++, so it is quite
possible to have multiple proxy classes for one underlying C/C++
object.
Post by Joel Andersson
_wrap_new_Foo(foo_proxy, constructor_arguments)
How can I change the wrapping of constructors this way?
Not possible atm. What are you planning on doing and how will it work?
It sounds like some fundamental changes to the SWIG runtime.

William

------------------------------------------------------------------------------
Loading...