#include "mathlink.h"
/* create a link and establish the connection */
int main(int argc, char **argv)
{
MLENV env;
MLINK link;
int error;
env = MLInitialize((char *)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 */ }
/* MLActivate will establish the connection */
if(!MLActivate(link))
{ /* unable to establish communication */ }
/* ... */
MLClose(link);
MLDeinitialize(env);
return 0;
}