Search All of the Math Forum:
Views expressed in these public forums are not endorsed by
Drexel University or The Math Forum.
|
|
|
|
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"?
|
|
|
|