During the last few days I have been trying to control a JEXEServer from
C#.   I have downloaded, studied
and compiled Alex Rufon's example on the J wiki but I cannot get it to
behave.

I am using the free Visual C# Express edition.  I don't believe there are
any C# version specific issues but I could
be wrong.  The following snippet is just about the simplest possible use of
a JEXEServer

private void button1_Click(object sender, EventArgs e)
{
  object jout;
  string jstr;

  JEXEServerLib.JEXEServer jObject = new JEXEServerLib.JEXEServer();

  jObject.Log(1);
  jObject.Show(1);

  jObject.Do("jRes=. 'string from J'");
  jObject.GetB("jRes", out jout);
  jstr = (string) jout;

  textBox.Text = jstr;
  jObject.Quit();
  jObject = null;
}
 This almost works with the following exceptions:

1) The JEXEServer never appears despite being requested with a Show(1)
2) The Quit() does not shutdown the J server
3) Exiting the C# app leads to an invalid memory reference in J.  Probably
related to not shutting down properly.

I can see J executing as j.exe shows in the process list and I can send and
receive data from the server.  I have used similiar code in VB for years and
I judge people (Alex) have managed this from C# as well.  Has anyone tried
this recently in any of the Express compilers.
-- 
John D. Baker
[email protected]
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to