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
|
 |
|
|
Re: Making C++ objects persistent between mex calls, and robust.
Posted:
Jun 8, 2010 9:42 AM
|
|
> classdef myclass < handle > properties (Hidden = true, SetAccess = private) > cpp_handle; > end > methods > % Constructor > function this = myclass() > this.cpp_handle = init_mex(); > end > % Destructor > function delete(this) > clear_mex(this.cpp_handle); > end > % Example method > function output = action(this, data) > output = action_mex(this.cpp_handle, data); > end > end > end
Thank you Oliver. I have a couple more questions if you have a second:
What are you returning from init_mex()? Is that a pointer to a C++ class instance? If so, how are you allocating the memory, are you using "new" or "mxMalloc"?
|
|
|
|