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 ) ;
but get the following (very reasonable!) error:
==== /home/rupert/src/mine/factor/geometry/arpack/ffi/ffi.factor /home/rupert/src/mine/factor/geometry/arpack/ffi/ffi.factor: 18 Asset: DSAUPD Stack effect declaration is wrong inferred (( x x x x x x x x x x x x x x x x -- x x x x x x x x )) declared (( IDO BMAT N WHICH NEV TOL RESID NCV V LDV IPARAM IPNTR WORKD WORKL LWORKL INFO -- ))
Is there a way to tell factor that I want return arguments? Rupert [1] http://www.caam.rice.edu/software/ARPACK/ [2] http://www.caam.rice.edu/software/ARPACK/UG/node23.html [3] http://www.caam.rice.edu/software/ARPACK/UG/node136.html
pgprnw2SctIOQ.pgp
Description: PGP signature
------------------------------------------------------------------------------ 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