how to find packages when using NETLINK
- To: mathgroup at smc.vnet.net
- Subject: [mg54343] how to find packages when using NETLINK
- From: Andreas Tanner <tanner at ivs.tu-berlin.de>
- Date: Sat, 19 Feb 2005 02:31:43 -0500 (EST)
- Organization: Technische Universitaet Berlin, Deutschland
- Sender: owner-wri-mathgroup at wolfram.com
Hi,
Mathematica doesn't find my packages when I call it from Visual C#. In
fact, the Path variable returns "Null". Here is the code I try:
##############
System.Threading.Thread.CurrentThread.CurrentCulture = new
System.Globalization.CultureInfo("en-us");
IKernelLink ml = MathLinkFactory.CreateKernelLink("-linkmode launch
-linkname 'c:\\program files\\wolfram
research\\mathematica\\4.2\\mathkernel'");
ml.Evaluate("$Path");
ml.WaitForAnswer();
Console.WriteLine(ml.GetObject().ToString());
###############
this throws a System.NullReferenceException.
I also tried to set the Path via
###############
string s = "$Path=Flatten[{\"C:\\Documents and Settings\\Andreas
Tanner\\My Documents\", $Path}]";
ml.Evaluate(s);
###############
but this doesn't work either, that is, a package in that directory
doesn't load via <<MyPackage.
Any hints?
???
--Andreas