23.07.2012 Views

MATLAB C++ Math Library Reference

MATLAB C++ Math Library Reference

MATLAB C++ Math Library Reference

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

mwSet<strong>Library</strong>AllocFcns<br />

0mwSet<strong>Library</strong>AllocFcns<br />

Purpose Set memory management functions for <strong>MATLAB</strong> <strong>C++</strong> <strong>Math</strong> <strong>Library</strong><br />

<strong>C++</strong> Prototype void mwSet<strong>Library</strong>AllocFcns(<br />

mwMemCallocFunc callocProc,<br />

mwMemFreeFunc freeProc,<br />

mwMemReallocFunc reallocProc,<br />

mwMemAllocFunc mallocproc,<br />

mwMemCompactFunc=0);<br />

Arguments callocProc<br />

A pointer to a function that allocates memory. mwMemCallocFunc is defined as:<br />

typedef void *(*mwMemCallocFunc)(size_t, size_t);<br />

freeProc<br />

A pointer to a function that frees memory. mwMemFreeFunc is defined as:<br />

typedef void (*mwMemFreeFunc)(void *);<br />

reallocProc<br />

A pointer to a function that reallocates memory. mwMemReallocFunc is defined<br />

as:<br />

typedef void *(*mwMemReallocFunc)(void *, size_t);<br />

mallocproc<br />

A pointer to a function that allocates memory. mwMemAllocFunc is defined as:<br />

typedef void *(*mwMemAllocFunc)(size_t);<br />

compactproc<br />

Not currently used.<br />

Description Sets the <strong>MATLAB</strong> <strong>C++</strong> <strong>Math</strong> <strong>Library</strong>’s memory management functions. Gives<br />

you complete control over memory management.<br />

To set up your own memory management routines, you need to write four<br />

routines: two memory allocation routines, one memory reallocation routine,<br />

and one deallocation routine. You then call mwSet<strong>Library</strong>AllocFcns() to<br />

register those routines with the library.<br />

You cannot omit any of the four routines. However, the last argument to<br />

mwSet<strong>Library</strong>AllocFcns(), mwMemCompactFunc, is not currently used and is<br />

416

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!