MLLinkName (C Function)

MLLinkName has been replaced by WSLinkName.

const char * MLLinkName(MLINK link)

returns the name string used to create the link.

Details

  • MLLinkName() allocates memory for the link name that must be released. To release the memory, call MLReleaseLinkName() on the value returned by the function. If MLLinkName() returns NULL, do not call MLReleaseLinkName() on the NULL value.
  • Programs should not modify the contents of the string returned by MLLinkName().
  • MathLink 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.
  • MLLinkName() is declared in the MathLink header file mathlink.h.

Examples

Basic Examples  (4)

Use the Pipes protocol on Unix or Mac OS X to launch a link:

The link name contains the pathname and command-line arguments to use to connect to the link:

Use the TCPIP protocol to create a link:

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

Use the SharedMemory protocol to create a link:

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

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

#include "mathlink.h"

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

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

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

    /* ... */

    MLReleaseLinkName(lp, name);
}