Basically, I took Alex Rufon's session class from
http://www.jsoftware.com/jwiki/Guides/J%20VB.NET
With a simplified initialize function:
private void initialize()
{
// Create a new copy of the J Object and make sure were in the Z locale
jObject = new JEXEServerClass();
jObject.Quit();
jObject.Do(@"BINPATH_z_=:1!:46''");
jObject.Do(@"ARGV_z_=:'oleclient';'-jijx'");
jObject.Do(@"(3 : '0!:0 y')<BINPATH,'\profile.ijs'");
if (debug)
{
// Shows a complete J console
jObject.Do("newijx_jijs_''");
}
// Get J version
object result;
jObject.DoR("9!:14 ''", out result);
jObject.Do("18!:4 <'z'");
}
And here is the program (main function and a little helper function):
using System;
namespace JSoftware
{
class Program
{
static void Main()
{
Session jSession = new Session(true);
int singleInt = 16;
jSession.Variable("SingleInt", singleInt);
object singleIntObj = jSession.Variable("SingleInt");
//This should work fine
Console.WriteLine("Original single int value : " + singleInt);
Console.WriteLine("J returned single int value: " +
((int)singleIntObj));
//Verify manually SingleInt in your J Session, value should
be identical
int[] intArray = { 4, 8, 15, 16, 23, 42 };
jSession.Variable("IntArray", intArray);
object intArrayObj = jSession.Variable("IntArray");
//This should also work fine
Console.WriteLine("Original int array value : " +
(IntArrayToString(intArray)));
Console.WriteLine("J returned int array value : " +
(IntArrayToString((int[])intArrayObj)));
//But break here and look at IntArray in J 64bit
Console.ReadLine();
}
private static string IntArrayToString(int[] array)
{
string result = "";
foreach (int single in array)
{
result += single + " ";
}
return result.Trim();
}
}
}
The code is a tiny bit different from the project, but is essentially
the same. I just thought providing a ready-made project would be easier,
but I'm more than willing to adapt to get to the bottom of this issue.
Martin Pelletier
On 2010-10-12 09:41, bill lam wrote:
> I am afraid not too many of us want to install visual studio express in order
> to
> open your project. May be you can just post some relevant code by email for
> discussion.
>
> Втр, 12 Окт 2010, Martin Pelletier писал(а):
>
--
Martin Pelletier
Informatique / Software Development
Infodev Electronic Designers International Inc.
Tel : +1 (418) 681-3539, poste /ext. 114
Fax : +1 (418) 681-1209
Confidentiality Note: This e-mail may contain confidential information
belonging to Infodev Electronic Designers Inc. If you are not the intended
recipient, be aware that any disclosure, copying, distribution or use of the
contents of this e-mail is strictly prohibited. If you have received this
e-mail in error, please delete this e-mail and notify the sender immediately.
Note de confidentialité: Ce courriel peut contenir des informations
confidentielles qui appartiennent à Infodev Electronic Designers Inc. Si vous
avez reçu ce courriel par erreur, veuillez l'effacer et aviser l'expéditeur
immédiatement. Toute diffusion, utilisation ou copie de ce message ou des
renseignements qu'il contient par une personne autre que le (les)
destinataire(s) désigné(s) est strictement interdite.
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm