MathGroup Archive 2009

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Problem with mathlink:PLEASE HELP ME

On 18 mar, 10:57, Chris Hill <ch... at> wrote:
> At 04:59 AM 3/17/2009, olfa wrote:
> >Hi mathematica community,
> >Under windows xp,I have a c++ program in which I established a
> >comunication with mathematica via mathlink.
> >But when my program is executed, a "Choose a MathLink Program to
> >Launch" dialog box appears and ask me to choose between some
> >executables. This is my code and the problem should be in the path of
> >the connection.
> >In this path I have chosen to launch mathkernel.exe so why the dialog box
> >appears and How can I GET RID OF THIS DIALOG BOX?
> >Thank you, I'm very gratefull for any help.
> >    ml = MLOpenString(env,"-linkname \"C:\\Program Files\\Wolfram
> >Research\\Mathematica\\6.0 \\MathKernel.exe\" -mathlink",&error);
> I suspect that you are encountering escaping issues with your
> linkname string containing the Windows path backslashes.  Also, the
> -mathlink parameter to the kernel should be part of the
> linkname.  Here are a few different ways to address those issues:
> 1) Use forward slashes (which Windows XP accepts):
> ml = MLOpenString("-linkname \"C:/Program Files/Wolfram
> Research/Mathematica/6.0/MathKernel.exe -mathlink\"", &error);
> 2) Add more escaping of the backslashes, one level for the C compiler
> and the other for MathLink:
> ml = MLOpenString("-linkname \"C:\\\\Program Files\\\\Wolfram
> Research\\\\Mathematica\\\\6.0\\\\MathKernel.exe -mathlink\"");
> 3) You may find it more convenient to use MLOpenArgcArgv instead of
> MLOpenString, which avoids the escaping issue:
>                  char* v[10];
>                  int c = 0;
>                  v[c++] = "-linkname";
>                  v[c++] = "C:\\Program Files\\Wolfram
> Research\\Mathematica\\6.0\\MathKernel.exe -mathlink";
>                  ml = MLOpenArgcArgv(env, c, v, &erro=
> Finally, if you are interested in suppressing the dialog box even if
> the link name was in fact incorrect you can use the MLDontBrowse option:
> ml = MLOpenString(env, "-linkname badlinkname -linkoptions
> MLDontBrowse",&error);
> Chris Hill
> Wolfram Research

thank you very much Mr Chris it works :)

  • Prev by Date: Re: Compatibility issue in Mathematica 7
  • Next by Date: Re: NMF problem
  • Previous by thread: Re: Problem with mathlink:PLEASE HELP ME
  • Next by thread: Re: Problem with mathlink:PLEASE HELP ME