>>  <<  Usr  Pri  JfC  LJ  Phr  Dic  Rel  Voc  !:  Help  User

J COM Automation Server

The J COM Automation server is JDLLSever (j.dll).

Any application with OLE Automation controller support (C#, Visual Basic, Excel, Visual C++,...) can use JDLLServer.

J64 JDLLServer has not been tested and are not officially supported.

J.DLL (J32 and J64) can be called directly (Calling J.DLL) without using COM.

Registration

JDLLServer must be registered with your system before it can be used. To register, run jreg.bat.

If there are problems later when accessing the J servers it may be because they are no longer properly registered. You can always run jreg.bat to register again. In particular, you will need to do this if you move the J system files to another directory.

Using JDLLServer

You should be familiar with both J and the client before tackling them in a client/server combination. In particular you should be familiar with using other OLE Automation servers from your client before working with J.

J server methods:
   Do                     execute J sentence
   ErrorText/ErrorTextM   get error text
   Get/GetB/GetM          get value of a J variable
   Set/SetB/SetM          set value of a J variable
   Transpose              return array data transposed 
J Server methods that have no effect:
   Break
   Clear
   IsBusy

Loading Profile

No scripts are loaded when the J server starts. In some cases you may want to load the standard J profile. Run the following sentences with the Do method to load profile.
BINPATH_z_=:1!:46''
ARGV_z_=:'oleclient';'-jijx'
(3 : '0!:0 y')<BINPATH,'\profile.ijs'
The 1st sentence sets BINPATH_z_ as the path to the J.DLL file (standard J bin folder). Foreign 1!:46 in Windows returns j.dll full path and can be used by JDLLServer clients to find the J folder.

The 2nd sentence sets ARGV_z_ as the commandline parameters used by profile. You can modify this as appropriate but ARGV_z_ must be a list of boxed strings.

The 3rd creates an unnamed verb that loads profile.ijs from BINPATH.

BSTR treated as 8 bit values

The original J server methods were implemented before J supported UTF8 or UTF16 data. BSTR data is transferred between the client and J by ignoring the top byte. This is fine for 7 bit ascii data but means that unicode 16 bit data is treated as if the top 8 bits were always 0.

A future J release may treat BSTR data correctly in all the methods. In the meantime the following workaround is suggested.

Use Get and Set methods to transfer the required unicode data as UTF8 bytes. This data will be a byte array on the client side and a UTF8 character array on the J side. On the client side there are classes (UTF8Encoding) that convert between BSTR and UTF8 byte arrays. And on the J side you can either use the UTF8 character array directly or use foreigns to convert to other formats (such as 16 bit character array).
>>  <<  Usr  Pri  JfC  LJ  Phr  Dic  Rel  Voc  !:  Help  User