WSReleaseUnicodeContainer()
This feature is not supported on the Wolfram Cloud.

void WSReleaseUnicodeContainer(WSUnicodeContainer *c)
releases the memory used to store the WSUnicodeContainer object c.

DetailsDetails

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

ExamplesExamplesopen allclose all

Basic Examples  (1)Basic Examples  (1)

#include "wstp.h"

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

void f(WSUnicodeContainer *container, WSINK link)
{
    if(container == (WSUnicodeContainer *)0)
        return;

    switch(WSUnicodeStringType(container))
    {
        case UCS2ContainerType:
            if(! WSPutUCS2String(link, WSUCS2String(container),
                WSUnicodeStringLength(container)))
            { /* Unable to send the UCS-2 encoded string */ }
            break;
        case UTF8ContainerType:
            if(! WSPutUTF8String(link, WSUTF8String(container),
                WSUnicodeStringLength(container)))
            { /* Unable to send the UTF-8 encoded string */ }
            break;
        case UTF16ContainerType:
            if(! WSPutUTF16String(link, WSUTF16String(container),
                WSUnicodeStringLength(container)))
            { /* Unable to send the UTF-16 encoded string */ }
            break;
        case UTF32ContainerType:
            if(! WSPutUTF32String(link, WSUTF32String(container),
                WSUnicodeStringLength(container)))
            { /* Unable to send the UTF-32 encoded string */ }
            break;
    }

    WSReleaseUnicodeContainer(container);
}