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

const char * WSLinkName(WSLINK link)
returns the name string used to create the link.

DetailsDetails

  • WSLinkName() allocates memory for the link name that must be released. To release the memory, call WSReleaseLinkName() on the value returned by the function. If WSLinkName() returns NULL, do not call WSReleaseLinkName() on the NULL value.
  • Programs should not modify the contents of the string returned by WSLinkName().
  • WSTP links are created using a combination of link mode, link protocol, and other options. The link name provides necessary information for the link mode and link protocol used to create the link.
  • WSLinkName() is declared in the WSTP header file wstp.h.

ExamplesExamplesopen allclose all

Basic Examples  (3)Basic Examples  (3)

Use the TCPIP protocol to create a link:

In[1]:=
Click for copyable input
Out[1]=

The link name contains the port and hostname pairs to use to establish the TCP connection:

In[2]:=
Click for copyable input
Out[2]=

Use the SharedMemory protocol to create a link:

In[1]:=
Click for copyable input
Out[1]=

The link name contains the name of the shared memory object:

In[2]:=
Click for copyable input
Out[2]=

Declare a const char * variable and get the link name:

#include "wstp.h"

/* A function for reading a link's name */

void f(MLINK lp)
{
    const char *name;

    name = WSLinkName(lp);
    if(name == (const char *)0)
    { /* Unable to get the link name */ }

    /* ... */

    WSReleaseLinkName(lp, name);
}