MathGroup Archive 2004

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

Search the Archive

Re: Launching the Mathematica interface via mathlink

  • To: mathgroup at
  • Subject: [mg50048] Re: [mg49667] Launching the Mathematica interface via mathlink
  • From: Omega Consulting <info at>
  • Date: Fri, 13 Aug 2004 05:55:42 -0400 (EDT)
  • References: <>
  • Sender: owner-wri-mathgroup at

You could have the kernel execute a LinkLaunch command. The kernel can 
then send commands to the frontend via its MathLink connection.

I'd try it out from the kernel first. Then from your program.

In[1]:= lnk = LinkLaunch["Mathematica -mathlink"]

Out[1]= LinkObject[Mathematica -mathlink, 1, 1]

If you want to execute commands that interact with the fe, then you 
need to set $FrontEnd and $Notebooks.

In[2]:= $FrontEnd = FrontEndObject[lnk];

In[3]:= Unprotect[$Notebooks];

In[4]:= $Notebooks=True;

Now you can use the normal set of kernel commands to interact with the 
frontend. For example,

In[5]:= Notebooks[]

Out[5]= {NotebookObject[<<Untitled-1>>], NotebookObject[<<Messages>>]}

On Jul 27, 2004, at 6:00 AM, Peter Saffrey wrote:

> Is this possible? I have some code that interacts with a Mathematica
> kernal via mathlink. When it has finished, I'd like to fire up the
> Mathematica interface to allow my user to "poke around" in the
> results, draw graphs and so on. I know I could just invoke a
> Mathematica session from the command line, but how could I then gain
> access to this session via Mathlink to set up the appropriate
> variables?
> Any advice gratefully received,
> Peter

Omega Consulting
The final answer to your Mathematica needs.

  • Prev by Date: Help: piecewise functions
  • Next by Date: Re: What's wrong with this small code?
  • Previous by thread: Re: Help: piecewise functions
  • Next by thread: Simplify, FullSimplify, .....