WSPutUCS2Function (C Function)

int WSPutUCS2Function(( WSLINK l , const unsigned short * s , int v , int n )

puts a function with head given by a UCS2 encoded symbol with name s of length v and with n arguments to the WSTP connection specified by l.

Details

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

Examples

Basic Examples  (1)

#include "wstp.h"

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

void f(WSLINK l)
{
    unsigned short name[4];

    name[0] = 'L';
    name[1] = 'i';
    name[2] = 's';
    name[3] = 't';

    if(! WSPutUCS2Function(l, (unsigned short *)name, 4, 3))
    { /* Unable to put the function to the link */ }

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

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

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

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

    if(! WSFlush(l))
    { /* Unable to flush any buffered output data in the link */ }
}