"Gabri Gwala" wrote: > There is something unclear to me: > > 1) > I see that at every invocation of a function on the interface, a new instance of class CLASS_HANDLE is created (since is called convertPtr2Mat). This class offers also a destroyer, but I cannot see where it is called.
The destructor is called automatically when using delete, on the first line of the destroyObject() function, which is called on line 37 of class_mex_interface.cpp.
> 2) > mexLock() is called just before creating a new instance of CLASS_HANDLE.
> This happens every time a function is invoked on the interface.
No. Why do you think that?
> 3) > The usage of the wrapping class CLASS_HANDLE is necessary for the interface to work, or it only provides useful auxiliary methods, for example the check !ptr->isValid()?
It simply provides a means of checking that you are not casting a random memory address to a pointer to an instance of the base class. Doing that could lead to some bad things happening, so it is a protection against that.