WSReleaseUTF16ErrorMessage (C Function)

void WSReleaseUTF16ErrorMessage(WSLINK l, const unsigned short *m, int n)

releases memory allocated by WSUTF16ErrorMessage() to store the UTF-16 encoded message in m, an array of length n.

Details

  • The memory used to contain the message m must have been allocated by a call to WSUTF16ErrorMessage().
  • WSReleaseUTF16ErrorMessage() is declared in the WSTP header file wstp.h.

Examples

Basic Examples  (1)

#include "wstp.h"

/* A function to retrieve the error message from a link */

void f(WSLINK l)
{
    const unsigned short *message;
    int length;

    message = WSUTF16ErrorMessage(l, &length);

    /* We test for length <= 1 because WSUTF16Error message
    returns a string that begins with a byte order mark */

    if(message == (const unsigned short *)0 || length <= 1)
    { /* Unable to retrieve the error message from the link */ }

    /* ... */

    WSReleaseUTF16ErrorMessage(l, message, length);
}