Advertisement
Guest User

Testcode from question 34765 on Mathematica.stackexchange

a guest
Oct 26th, 2013
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.58 KB | None | 0 0
  1. #include <mathlink.h>
  2. #include <stdio.h>
  3. #include <stdlib.h>
  4.  
  5. void MAXF(char* ex1, char* ex2, char** result){
  6.    MLINK lp;
  7.    int pkt;
  8.    MLEnvironment env;
  9.    env = MLInitialize(NULL);
  10.    if (env == NULL) return;
  11.    int argcs = 4;
  12.    char *argvs[5] = {"-linkmode", "launch", "-linkname", "math -mathlink", NULL};
  13.    lp = MLOpen(argcs, argvs);
  14.    if (lp == NULL) return;
  15.  
  16.    *result = malloc(100);
  17.    sprintf(*result, "0");
  18.  
  19.    MLPutFunction(lp, "Exit", 0L);
  20.    MLClose(lp);
  21.    MLDeinitialize(env);
  22. };
  23.  
  24. int main(){
  25.    char* test;
  26.    MAXF("0", "0", &test);
  27.    return 0;
  28. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement