MLGetLinkedEnvIDString has been replaced by WSGetLinkedEnvIDString.

int MLGetLinkedEnvIDString(MLINK link,const char **e)

returns the identification string of the MathLink environment connected to link and stores it in e.


  • MLGetLinkedEnvIDString() allocates the memory for the string eid. You must call MLReleaseEnvIDString() to disown this memory. If MLGetLinkedEnvIDString() fails and the function's return value indicates an error, do not call MLReleaseEnvIDString() on the contents of e.
  • MLGetLinkedEnvIDString() returns an immutable string.
  • The environment identification returned by MLGetLinkedEnvIDString() is a null-terminated ASCII string.
  • MLGetLinkedEnvIDString() will not work until link is connected.
  • MLGetLinkedEnvIDString() returns 0 in the event of an error, and a nonzero value if the function succeeds.
  • Use MLError() to retrieve the error code if MLGetLinkedEnvIDString() fails.
  • MLGetLinkedEnvIDString() is declared in the MathLink header file mathlink.h.


Basic Examples  (1)

#include <string.h>
#include "mathlink.h"

/* read the id from a link and check for "My Remote Program" */

#define ERROR -1

int f(MLINK lp)
    int isCorrectProg;
    const char *e;

    if(! MLGetLinkedEnvIDString(lp, &e))
            /* unable to read the link id from lp */
            return ERROR;

    isCorrectProg = strcmp(envid, "My Remote Program") == 0;

    MLReleaseEnvIDString(lp, e, length);

    return isCorrectProg;

See Also

MLSetEnvIDString()  MLReleaseEnvIDString()  MLActivate()