Hacker News new | ask | show | jobs
by jodrellblank 1544 days ago
J has support for being integrated into other projects[1], e.g. the link below has C# and Excel links at the end. You can use it as a COM server if you run 'jreg.cmd' first to register it.

As an administrator:

    PS C:\Program Files\j64-807> .\jreg.cmd
e.g. awkwardly, from PowerShell:

    $J = new-object -ComObject JExeServer

    PS C:\> $J.Set('numbers', [int[]](1,2,3))
    0
    PS C:\> $J.Do('answer =: numbers * 2')
    0

    PS C:\> $Result = $null
    PS C:\> $J.get('answer', [ref]$Result)
    0
    PS C:\> $Result
    2
    4
    6

or

    PS C:\> $J.Do("oops")
    21

    PS C:\> $Text = $null
    PS C:\> $J.ErrorText(21, [ref]$Text)
    0
    PS C:\> [system.text.encoding]::ASCII.GetString($Text)
    value error

[1] https://code.jsoftware.com/wiki/Guides/OLE_Automation