The Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.matlab

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: Making C++ objects persistent between mex calls, and robust.
Replies: 38   Last Post: Aug 5, 2017 8:06 PM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Oliver Woodford

Posts: 615
Registered: 8/3/07
Re: Making C++ objects persistent between mex calls, and robust.
Posted: Sep 27, 2013 6:54 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

"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.


Yes.

> 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.


Date Subject Author
4/1/10
Read Making C++ objects persistent between mex calls, and robust.
Oliver Woodford
6/7/10
Read Re: Making C++ objects persistent between mex calls, and robust.
Anthony Halley
6/8/10
Read Re: Making C++ objects persistent between mex calls, and robust.
Oliver Woodford
6/8/10
Read Re: Making C++ objects persistent between mex calls, and robust.
Oliver Woodford
6/8/10
Read Re: Making C++ objects persistent between mex calls, and robust.
Walter Roberson
6/8/10
Read Re: Making C++ objects persistent between mex calls, and robust.
Anthony Halley
6/8/10
Read Re: Making C++ objects persistent between mex calls, and robust.
Oliver Woodford
1/22/11
Read Re: Making C++ objects persistent between mex calls, and robust.
newuser asdf
1/22/11
Read Re: Making C++ objects persistent between mex calls, and robust.
Bruno Luong
1/23/11
Read Re: Making C++ objects persistent between mex calls, and robust.
Rune Allnor
1/23/11
Read Re: Making C++ objects persistent between mex calls, and robust.
Bruno Luong
1/23/11
Read Re: Making C++ objects persistent between mex calls, and robust.
newuser asdf
1/24/11
Read Re: Making C++ objects persistent between mex calls, and robust.
Oliver Woodford
2/3/11
Read Re: Making C++ objects persistent between mex calls, and robust.
Pierre
2/3/11
Read Re: Making C++ objects persistent between mex calls, and robust.
Oliver Woodford
2/3/11
Read Re: Making C++ objects persistent between mex calls, and robust.
Pierre
2/3/11
Read Re: Making C++ objects persistent between mex calls, and robust.
Oliver Woodford
2/15/11
Read Re: Making C++ objects persistent between mex calls, and robust.
Pierre
7/6/11
Read Re: Making C++ objects persistent between mex calls, and robust.
mathias
7/6/11
Read Re: Making C++ objects persistent between mex calls, and robust.
Oliver Woodford
5/24/12
Read Re: Making C++ objects persistent between mex calls, and robust.
Ajay
5/25/12
Read Re: Making C++ objects persistent between mex calls, and robust.
Pierre
10/2/12
Read Re: Making C++ objects persistent between mex calls, and robust.
Oliver Woodford
11/7/12
Read Re: Making C++ objects persistent between mex calls, and robust.
Francesco Montorsi
11/8/12
Read Re: Making C++ objects persistent between mex calls, and robust.
Oliver Woodford
11/9/12
Read Re: Making C++ objects persistent between mex calls, and robust.
Oliver Woodford
1/21/13
Read Re: Making C++ objects persistent between mex calls, and robust.
Oliver Woodford
1/22/13
Read Re: Making C++ objects persistent between mex calls, and robust.
Oliver Woodford
1/30/13
Read Re: Making C++ objects persistent between mex calls, and robust.
Gabri Gwala
1/30/13
Read Re: Making C++ objects persistent between mex calls, and robust.
Steven Lord
1/31/13
Read Re: Making C++ objects persistent between mex calls, and robust.
Oliver Woodford
9/22/13
Read Re: Making C++ objects persistent between mex calls, and robust.
Gabri Gwala
9/22/13
Read Re: Making C++ objects persistent between mex calls, and robust.
Gabri Gwala
9/27/13
Read Re: Making C++ objects persistent between mex calls, and robust.
Oliver Woodford
6/8/10
Read Re: Making C++ objects persistent between mex calls, and robust.
Anthony Halley
6/8/10
Read Re: Making C++ objects persistent between mex calls, and robust.
Anthony Halley
8/5/17
Read Re: Making C++ objects persistent between mex calls, and robust.
Raunak Borker

Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© The Math Forum at NCTM 1994-2018. All Rights Reserved.