Message Boards Message Boards

5
|
3634 Views
|
0 Replies
|
5 Total Likes
View groups...
Share
Share this post:

Control Front End in "mathlink" mode

In a terminal math session, we can start a front end (FE) easily by launching it though LinkLaunch or by using functions provided in the Developer` context. Here is an example

<<Developer`;
lnk = Developer`InstallFrontEnd["Server"->False];
LinkWrite[lnk,FrontEndToken["New"]]

Unfortunately, the started FE starts the default kernel which is usually a good idea, but here I want to be in control of everything. This means, I would like to tell the front end the link where it can connect to a kernel. So what I really want to have is a mathlink/JLink program that starts a kernel and an FE, connects both so that the front end uses the kernel as evaluator but all communication goes through my program.

If you are familiar with LinkSnooper, then you see the difference: The FE starts the LinkSnooper as special kernel. What I want (not only for snooping, but for a more general problem) is similar but more problematic, because I want to control the kernel starting behavior of the FE from a link and not as user.

Question: Is there any direct way to do it?


Appendix: One way that I haven't tested before asking here is modify the init.m of the FE (usually located it $UserBaseDirectory/FrontEnd/init.m), because there are the settings for the kernel:

EvaluatorNames->{
  "Local" -> {"AutoStartOnLaunch" -> True}, 
  "LinkSnooper" -> {...}
}

So I could theoretically alter the settings there (hopefully on the fly during startup of the FE) and force the FE to connect to my specific kernel.

POSTED BY: Patrick Scheibe
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract