On Wed, Dec 1, 2010 at 6:13 AM, Rupert Swarbrick <rswarbr...@gmail.com>wrote:
>
> Hi,
>
> Is it possible to define subroutines with output parameters using the
> Fortran FFI? I'm trying to wrap (some of!) arpack[1] and, following the
> example in the manual[2], want to do something with DSAUPD.
>
> The interface for DSAUPD is defined at [3], but basically it's a
> subroutine that takes loads of parameters, some of which are
> input/output.
>
> I tried the following:
>
> USING: alien.fortran kernel ;
> FROM: alien.libraries => deploy-library ;
> IN: geometry.arpack.ffi
>
> <<
> "arpack" "libarpack.so.2" gfortran-abi add-fortran-library
> "arpack" deploy-library
> >>
>
> LIBRARY: arpack
>
> SUBROUTINE: DSAUPD
> ( !INTEGER IDO, CHARACTER*1 BMAT, INTEGER N, CHARACTER*2 WHICH,
> INTEGER NEV, DOUBLE-PRECISION TOL, !DOUBLE-PRECISION(*) RESID,
> INTEGER NCV, !DOUBLE-PRECISION(*) V, INTEGER LDV,
> !INTEGER(11) IPARAM, !INTEGER(11) IPNTR,
> !DOUBLE-PRECISION(*) WORKD, !DOUBLE-PRECISION(*) WORKL,
> INTEGER LWORKL, !INTEGER INFO ) ;
>
You've got the right idea, Rupert, but there was a bug in the SUBROUTINE:
and FUNCTION: parsing words that caused them to define the words with the
wrong stack effect. I've pushed a fix.
-Joe
------------------------------------------------------------------------------
Increase Visibility of Your 3D Game App & Earn a Chance To Win $500!
Tap into the largest installed PC base & get more eyes on your game by
optimizing for Intel(R) Graphics Technology. Get started today with the
Intel(R) Software Partner Program. Five $500 cash prizes are up for grabs.
http://p.sf.net/sfu/intelisp-dev2dev
_______________________________________________
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk