MathGroup Archive 2005

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

Search the Archive

Re: Processing graphics from C programme with MathLink

  • To: mathgroup at
  • Subject: [mg60815] Re: Processing graphics from C programme with MathLink
  • From: "Jens-Peer Kuska" <kuska at>
  • Date: Thu, 29 Sep 2005 05:41:38 -0400 (EDT)
  • Organization: Uni Leipzig
  • References: <dhavf3$jff$>
  • Sender: owner-wri-mathgroup at


exporting graphics from the Kernel may need a FrontEnd
to get the font metrics. Have a look at the J/Link package
 (J/Link 2.10.6) how to run the FrontEnd as a service.


"Robert Cussons" <r.cussons at> schrieb im 
Newsbeitrag news:dhavf3$jff$1 at
|I have a C programme that reads data from a 
number of files and arranges them
| into a list for Mathematica to access and then 
plot, Mathematica then exports
| this plot as an .eps to ghostview. This works 
when I run the code direct from
| Mathematica, but now I have tried to transport 
the code into the C programme
| to fully automate the process and I cannot get 
it to work. As you can
| imagine, I have a number of set commands to 
produce the required tables. But
| I don't know how to check whether these are 
being processed correctly. The
| most puzzling thing is I don't know why, even if 
other things are wrong, why
| ghostview doesn't launch. Shown below is a 
section of code including the
| attempt to launch ghostview. I have been at this 
solidly for a few days now
| and would be very grateful for some help!! 
Thanks, Rob.
| MLINK lp;
| int pkt;
| MLEnvironment env;
|  env = MLInitialize(NULL);
| if(env == NULL)
| {
| return 1;
| }
| lp = MLOpen(argc, argv);
| if(lp == NULL)
| {
| return 1;
| }
| MLPutFunction(lp, "EvaluatePacket", 1);
| MLPutFunction(lp, "ToExpression", 1);
| MLPutString(lp,
| Join[pllist, labels], Rule[PlotRange, All], 
Rule[FrameTicks, List[Automatic,
| Automatic, None, Automatic]], Rule[AxesLabel, 
List[\"\", \"Energy/MeV\"]],
| Rule[ImageSize, List[1000, 1000]]], \"!gv 
energylevels.eps &\"]");
| while((pkt = MLNextPacket(lp)) && pkt != 
| MLNewPacket(lp);
| MLNewPacket(lp);
| MLEndPacket(lp);
| MLClose(lp);
| MLDeinitialize(env);

  • Prev by Date: Re: Importing (and dealing with) multiple files
  • Next by Date: Re: SingularValueDecomposition bug: fifty examples
  • Previous by thread: Processing graphics from C programme with MathLink
  • Next by thread: question about HoldForm