[Date Prev] [Date Next] [Thread Prev] [Thread Next] Date Index Thread Index Search archive:
Date:Mon Apr 21 16:20:53 2003 
Subject:Vector arguments to external procedures 
From:davidy 
Volume-ID:1030421.04 

Can anyone offer any suggestions as to how to persuade the external
interface to pass the address of an arbitrary element of a vector to an
external procedure?

This would often be useful, for example for performing an operation on
part of an array.

Just to be clear about what I mean: in C you might do

    int x[100];
    foo(*(x+30), 10);

to call foo for elements 30 to 39 of the array (where foo expects simply
an array and the number of elements in it). Likewise in Fortran

    integer x(100)
    call foo(x(31), 10)

does the same. All numerical packages take advantage of this, and it
would be nice to be able to call foo in an equivalent way from Pop-11 -
one ought to be able to say something like

    vars x = initintvec(100);
    exacc foo(x[30], 10);

However, as far as I can tell, the code that translates arguments for
external procedures is buried deep and I can't see how I can increment
the address of a vector before it is passed out.

I realise that I can always provide an intermediate external routine
that takes an address and an offset and adds them before calling the
real routine. However, that's a pain as it has to be done for every
external routine I want to call, and it would be much handier to have
something that did it in Pop-11.

Any thoughts?

David

PS I've been writing an interface to Lapack/BLAS in case you wonder why
I want this.