This script gives examples of calling J from J. Similar routines may be written in other languages that can call DLLs or shared objects.

Download the script callj.ijs

Download (and update as needed) this script to call J701 from J602 calljdm.ijs

Main definitions:

 jcmd     send sentence, return result
 jdo      send sentence to be executed
 jget     retrieve value of J noun
 jset     assign value to J noun

Utilities:

 jinit    initialize J instance, sets global pJ
 jfree    free J instance

For example:

  jinit''
158471920
   jdo 'a=: i.3'
0
   jget 'a'
0 1 2
   'a' jset 'hello'
   jget 'a'
hello
   jcmd '2 * 1 2j3'
2 4j6
   jfree''
0

Scripts/CallJ (last edited 2010-12-26 17:11:32 by DavidMitchell)