I have problem when using mathlink, the source code is quite simple:
void MAXF(char* ex1, char* ex2, char** result){
MLINK lp;
int pkt;
MLEnvironment env;
env = MLInitialize(NULL);
if (env == NULL) return;
int argcs = 4;
char *argvs[5] = {"-linkmode", "launch", "-linkname", "math -mathlink", NULL};
lp = MLOpen(argcs, argvs);
if (lp == NULL) return;
*result = malloc(100);
sprintf(*result, "0");
MLPutFunction(lp, "Exit", 0L);
MLClose(lp);
MLDeinitialize(env);
}
and in main, i call it by:
char* test;
MAXF("0", "0", &test);
However, after running, the terminal always shows this line:
In[2]:=
I believe that there is a problem, but I can't figure it out. Please help.