From tkoen|g @end|ng |rom netco|ogne@de  Sat May 11 17:04:06 2019
From: tkoen|g @end|ng |rom netco|ogne@de (Thomas Koenig)
Date: Sat, 11 May 2019 17:04:06 +0200
Subject: [Rd] R problems with lapack with gfortran
In-Reply-To: <1bd74386-737b-724a-f27b-73a790d1cea7@tkoenig.net>
References: <ff60d7f9-e54d-473a-bc85-7989abc887da@tkoenig.net>
 <b24b0ef5-1f45-1a03-4153-f335e4f1f8a5@gmail.com>
 <2e68f333-1d10-02d4-3560-4b1b9d773a52@tkoenig.net>
 <6E812A6F-91B2-4412-A536-2CD672C5F4BA@xs4all.nl>
 <D521C66E-D67E-4C17-98EF-D651026561ED@gmail.com>
 <79689a6a-077c-019a-d16a-597d7b60199d@tkoenig.net>
 <20190504164903.GB15478@troutmask.apl.washington.edu>
 <1bd74386-737b-724a-f27b-73a790d1cea7@tkoenig.net>
Message-ID: <a57aaa3e-e2fb-96e3-0ba1-c7be2a138b3e@netcologne.de>

Hi,

gfortran trunk and 9-branch now have an option to automatically
generate C prototypes for old-style F77 procedures.  I just did

for a in *.f; do gfortran -fsyntax-only -fc-prototypes-external $a > 
${a%.f}.h; done

in the src/modules/lapack directory.  This generates header
files which contain prototypes like

int ilaenv_ (int *ispec, char *name, char *opts, int *n1, int *n2, int 
*n3, int *n4, size_t name_len, size_t opts_len);
void dlacn2_ (int *n, double *v, double *x, int *isgn, double *est, int 
*kase, int *isave);
void dlaln2_ (int_least32_t *ltrans, int *na, int *nw, double *smin, 
double *ca, double *a, int *lda, double *d1, double *d2, double *b, int 
*ldb, double *wr, double *wi, double *x, int *ldx, double *scale, double 
*xnorm, int *info);
void dlabad_ (double *small, double *large);
void drscl_ (int *n, double *sa, double *sx, int *incx);
void dlatrs_ (char *uplo, char *trans, char *diag, char *normin, int *n, 
double *a, int *lda, double *x, double *scale, double *cnorm, int *info, 
size_t uplo_len, size_t trans_len, size_t diag_len, size_t normin_len);

which could serve as the basis for adjusting the calling sequence
for the C bindings to what the compiler expects.

I checked, and it appears that at least ifort uses the same convention
as gfortran 8/9 regarding character argument passing.

Regards

	Thomas



[Rd] R problems with lapack with gfortran
Thomas Koenig