MLReleaseUnicodeContainer (C Function)

MLReleaseUnicodeContainer has been replaced by WSReleaseUnicodeContainer.

void MLReleaseUnicodeContainer(MLUnicodeContainer *c)

releases the memory used to store the MLUnicodeContainer object c.

Details

  • MLReleaseUnicodeContainer() is used in conjunction with MLNewUnicodeContainer() to create and destroy MLUnicodeContainer objects in MathLink template files. The MLUnicodeContainer is a convenient object for passing Unicode strings and their lengths between functions in template files..
  • In most cases, the MathLink template file processor program mprep will generate code that automatically calls MLReleaseUnicodeContainer().
  • MLReleaseUnicodeContainer() is declared in the MathLink header file mathlink.h.

Examples

Basic Examples  (1)

#include "mathlink.h"

/* A simple function for sending a Unicode string using a MLUnicodeContainer object */

void f(MLUnicodeContainer *container, MLINK link)
{
    if(container == (MLUnicodeContainer *)0)
        return;

    switch(MLUnicodeStringType(container))
    {
        case UCS2ContainerType:
            if(! MLPutUCS2String(link, MLUCS2String(container),
                MLUnicodeStringLength(container)))
            { /* Unable to send the UCS-2 encoded string */ }
            break;
        case UTF8ContainerType:
            if(! MLPutUTF8String(link, MLUTF8String(container),
                MLUnicodeStringLength(container)))
            { /* Unable to send the UTF-8 encoded string */ }
            break;
        case UTF16ContainerType:
            if(! MLPutUTF16String(link, MLUTF16String(container),
                MLUnicodeStringLength(container)))
            { /* Unable to send the UTF-16 encoded string */ }
            break;
        case UTF32ContainerType:
            if(! MLPutUTF32String(link, MLUTF32String(container),
                MLUnicodeStringLength(container)))
            { /* Unable to send the UTF-32 encoded string */ }
            break;
    }

    MLReleaseUnicodeContainer(container);
}