j807 must get from result of cd, like this
0 3{ (sqrdll, 'sqr  i i *i *i') cd (#y);y;res

On Sun, Nov 18, 2018, 2:22 PM Ben Gorte <[email protected] wrote:

> Dear All,
>
> Long ago I made quite a lot of c-functions that I am calling from J using
> the cd mechanism (load 'dll') in linux.
>
> They stopped working in j64-807. I see in the release notes that indeed
> something has changed, but I cannot quite relate that to my case (but maybe
> I should - I'm not sure I entirely understand the story).
>
> In the simplest form it looks like this:
> First the c-code, sqr.c :
> int sqr (int n, int a[], int b[])
> {
>    int i, sumsqr=0;
>    for (i=0; i<n; i++)
>       sumsqr += b[i] = a[i] * a[i];
>    return sumsqr;
> }
>
> which I compile with
> gcc -O3 -shared -fPIC -o sql.so -Wl,--no-as-needed sqr.c
> (omitting -O3 does not make a difference).
>
> In J I go like:
>
> load 'dll'
>
> sqrdll =: jpath '~user/ext/sqr.so '
>
>
> sqr =: 3 : 0
>
> res =. (#y)#4 NB. make sure it's integer
>
> ret =. (sqrdll, 'sqr > i i *i *i') cd (#y);y;res
>
> ret, res
>
> )
>
>
> Up until j806 I would get:
>
> sqr i.10
>
> 285 0 1 4 9 16 25 36 49 64 81
>
>
> But in j807:
>
> sqr i.10
>
> 285 4 4 4 4 4 4 4 4 4 4
>
>
>
> So my DLL 'reads' an array alright, but seems to be not 'writing' it.
>
>
> For completeness:
>    JVERSION
> Engine: j807/j64/linux
> Release: commercial/2018-10-04T15:00:41
> Library: 8.07.20
> Qt IDE: 1.7.7/5.5.1
> Platform: Linux 64
> Installer: J807 install
> InstallPath: /home/ben/j64-807
> Contact: www.jsoftware.com
>
> Perhaps I'm overlooking something trivial; any help is highly appreciated!
>
> Ben
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to