Notes
Someone asked recently about calling J from Excel on a 64 bit OS.
Here is a simple example using Windows 7 Pro 64, with Excel 2007. I had just installed Excel and J64-602 and ran jreg.bat to register the 64 bit JEXEServer and JDLLServer.
I created the following Macro:
Sub Main()
Dim jObject As New JDLLServerLib.JDLLServer
Rem Dim jObject As New JEXEServerLib.JEXEServer
Dim rObject As Variant
Rem jObject = New JDLLServerLib.JDLLServer
Rem jObject.Do ("11!:0'pc Session;cc e editijx;'")
Rem jObject.Log (1)
Rem jObject.Show (1)
Rem Status = jObject.DoR("2| !/~i.4", rObject)
Status = jObject.DoR(">(4 8 i.3!:0 <.2^33){'Got J64';'Got J32'", rObject)
MsgBox ("J DoR ended with status" & Str(Status) & " and result" & vbCrLf & rObject)
jObject.Quit
End Sub
I enabled the JDLL reference:
As you can see, the reference is to J64-602.
I ran the code and here is the result:
I tested on Windows 7_64 with Excel 2007_32 and Excel Beta 2010_64. These tests showed that Excel_32 will only use 32 bit J.DLL and Excel_64 will use 64 bit J.DLL. Both 32 bit J.DLL and 64 bit J.DLL can be registered at the same time.
I just tested with Excel 2010_32 and J701 Beta. I updated the registry using regsvr32 j.dll and added lines to display the J version. Here is the result:
Footnotes
Fragmentary J.DLL debugging code:
Sub Main()
Dim jObject As New JDLLServerLib.JDLLServer
Dim rObject As Variant
Status = jObject.Do("ARGV_z_=:<'j.exe'")
Status = jObject.Do("13!:0]1")
Status = jObject.DoR("0!:0<'C:\Users\me\j602-user\projects\Grapics\exiftoolrt.ijs'", rObject)
MsgBox ("load:" & Str(Status) & " and result" & vbCrLf & rObject)
Call DBGJ(jObject)
Status = jObject.DoR("cotagjpgsdir'd:\JPEG'", rObject)
MsgBox ("Fn Call:" & Str(Status) & " and result" & vbCrLf & rObject)
jObject.Quit
End Sub
Sub DBGJ(jO As JDLLServerLib.JDLLServer)
Dim rObject As Variant
While 1
resp = InputBox("dbg", "J.DLL debugger")
Select Case resp
Case "err"
Status = jO.DoR("13!:12''", rObject)
MsgBox ("Error Msg:" & Str(Status) & " and result" & vbCrLf & rObject)
Case "stack"
Status = jO.DoR("13!:18''", rObject)
MsgBox ("Stack:" & Str(Status) & " and result" & vbCrLf & rObject)
Case "quit"
Exit Sub
Case Else
Status = jO.DoR(resp, rObject)
MsgBox ("J Immex" & Str(Status) & " and result" & vbCrLf & rObject)
End Select
Wend
End Sub
Contributed by DavidMitchell
