This feature is not supported on the Wolfram Cloud.

int WSPutUTF8Function((WSLINK l, const unsigned char *s, int v, int n)
puts a function with head given by a UTF-8 encoded symbol with name s of length v and with n arguments to the WSTP connection specified by l.


  • After the call to WSPutUTF8Function(), other WSTP functions must be called to send the arguments of the function.
  • WSPutUTF8Function() returns 0 in the event of an error, and a nonzero value if the function succeeds.
  • Use WSError() to retrieve the error code if WSPutUTF8Function() fails.
  • WSPutUTF8Function() is declared in the WSTP header file wstp.h.

ExamplesExamplesopen allclose all

Basic Examples  (1)Basic Examples  (1)

#include "wstp.h"

/* A function to put List[1,2,3] to the link */

void f(WSLINK l)
    unsigned char name[4];
    name[0] = 'L';
    name[1] = 'i';
    name[2] = 's';
    name[3] = 't';

    if(! WSPutUTF8Function(l, (const unsigned char *)name, 4, 3))
    { /* Unable to put the function head to the link */ }

    if(! WSPutInteger8(l, 1))
    { /* Unable to write 1 to the link */ }

    if(! WSPutInteger8(l, 2))
    { /* Unable to write 2 to the link */ }

    if(! WSPutInteger8(l, 3))
    { /* Unable to write 3 to the link */ }

    if(! WSEndPacket(l))
    { /* Unable to write the end-of-packet sequence to the link */ }

    if(! WSFlush(l))
    { /* Unable to flush the outbound data to the link */ }