This is documentation for Mathematica 6, which was
based on an earlier version of the Wolfram Language.
View current documentation (Version 11.2)
MathLink C Function


MLINK MLOpenString(MLENV env, const char *string, int *errno)
opens a MathLink connection taking parameters from a character string.
  • MLOpenString() takes a single string instead of the argv array used by MLOpenArgcArgv().
  • Arguments in the string are separated by spaces.
  • On some computer systems, giving NULL in place of the string pointer will cause arguments to be requested interactively, typically through a dialog box.
  • MLOpenString() is declared in the MathLink header file mathlink.h.
#include "mathlink.h"

int main()
    MLENV env;
    MLINK link;
    int error;

    env = MLInitialize((char *)0);
    if(env (MLENV)0)
        { /* unable to initialize MathLink environment */ }

    link = MLOpenString(env, "/usr/local/bin/math -mathlink", &error);
    if(link (MLINK)0 || error MLEOK)
        { /* unable to create link to the Kernel */ }

    /* ... */


    return 0;