Mathematica 9 is now available

LinkLaunch

Usage

LinkLaunch["prog"]启动外部程序prog且打开一个到它的一个连接。


Notes

LinkLaunch["prog"] 运行prog作为你当前Mathematica任务的辅助进程或子进程。 • 可以使用如同 LinkLaunch["math -mathlink"]的命令从你的Mathematica任务去启动一个辅助内核进程。 • 在大多数计算机系统,用相同的参数调用LinkLaunch["prog"] 几次将启动几个prog运行进程。 • 在一些计算机系统,LinkLaunch[ ] 将进行一个程序浏览。
LinkLaunch 返回一个 LinkObject.
• 选项LinkProtocol指定使用的隐含数据传输协议。
LinkLaunch 内部调用相似于MathLink库中函数MLOpenArgv() 的一个函数。
• 参见 Mathematica 全书: 2.12.7.
• 同时参见: Install, LinkCreate, LinkConnect, LinkClose.
Further Examples

LinkLaunch launches and connects to a program that is aware of MathLink. Here we launch a copy of Mathematica; a reason for doing this would be for two or more kernels to cooperate in solving a problem. This command works on any platform except the Macintosh.

In[1]:=  

Out[1]=

On the Macintosh you need to make a duplicate of MathKernel because you cannot launch an application from a single file more than once. Single quotes must surround the pathname if it contains spaces. This would be the command on the Macintosh: link = LinkLaunch["'MathKernel copy'"]

MathLink communicates using packets. When the second kernel starts up, it sends a packet containing the first input prompt to the program that launched it.

In[2]:=  

Out[2]=

To send an expression to the second kernel for evaluation, wrap it in an EvaluatePacket; the result comes back in a ReturnPacket. The Unevaluated around the expression keeps it from evaluating before it is sent.

In[3]:=  

Out[3]=

When you are finished, quit the second kernel.

In[4]:=  



Any questions about topics on this page? Click here to get an individual response.Buy NowMore Information
THIS IS DOCUMENTATION FOR AN OBSOLETE PRODUCT.
SEE THE DOCUMENTATION CENTER FOR THE LATEST INFORMATION.