OBSOLETE WSTP C FUNCTION

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

has been replaced by WSMain.


sets up communication between an external program started using Install and the Wolfram Language.

DetailsDetails

  • The code for MLMain() is generated automatically by mprep or mcc.
  • MLMain() opens a MathLink connection using the parameters specified in argv, then goes into a loop waiting for CallPacket objects to arrive from the Wolfram Language.
  • MLMain() internally calls MLOpenArgcArgv().
  • MLMain() is declared in the MathLink header file mathlink.h.

ExamplesExamplesopen allclose all

Basic Examples  (1)Basic Examples  (1)

#include "mathlink.h"

#if WINDOWS_MATHLINK

/* a Microsoft Windows example WinMain routine */

int PASCAL WinMain( HINSTANCE hinstCurrent, HINSTANCE hinstPrevious, LPSTR lpszCmdLine, int nCmdShow)
{
char buff[512];
char FAR * buff_start = buff;
char FAR * argv[32];
char FAR * FAR * argv_end = argv + 32;

     hinstPrevious = hinstPrevious; /* suppress warning */

if( !MLInitializeIcon( hinstCurrent, nCmdShow)) return 1;
MLScanString( argv, &argv_end, &lpszCmdLine, &buff_start);
return MLMain( (int)(argv_end - argv), argv);
}

#else

int main(int argc, char* argv[])
{
return MLMain(argc, argv);
}

#endif