MLOpenArgcArgv (C Function)

MLOpenArgcArgv has been replaced by WSOpenArgcArgv.

MLINK MLOpenArgcArgv(MLENV env,int argc,char** argv,int* errno)

opens a MathLink connection, taking parameters from command-line arguments.

Details

  • MLInitialize() must be called before MLOpenArgcArgv().
  • MLOpenArgcArgv() processes the command-line arguments and uses them to control the creation of the link.
  • MLOpenArgcArgv() recognizes the following command-line arguments:
  • "-linkconnect"connect to an existing link (LinkConnect)
    "-linkcreate"create a link (LinkCreate)
    "-linklaunch"launch a child process (LinkLaunch)
    "-linkname","name"the name to use in opening the link
    "-linkprotocol","protocol"the link protocol to use (TCPIP, Pipes, SharedMemory, etc.)
  • MLOpenArgcArgv() is not sensitive to the case of argument names.
  • MLOpenArgcArgv() ignores argument names that it does not recognize.
  • MLOpenArgcArgv() is called automatically by the MLMain() function created by mprep and mcc.
  • On some computer systems, giving for or a null pointer for will cause arguments to be requested interactively, typically through a dialog box.
  • MLOpenArgcArgv() is declared in the MathLink header file mathlink.h.

Examples

Basic Examples  (1)

#include "mathlink.h"

/* create a link using command-line parameters */

int main(int argc, char **argv)
{
    MLENV env;
    MLINK link;
    int error;

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

    /* let MLOpenArgcArgv process the command line */
    link = MLOpenArgcArgv(env, argc, argv, &error);
    if(link == (MLINK)0 || error != MLEOK)
        { /* unable to create the link */ }

    /* ... */

    MLClose(link);
    MLDeinitialize(env);

    return 0;
}