Has anyone ever successfully used Fortran character strings with R? ?Foreign says R C Fortran integer int * integer .... character char ** [compiler dependent] Character strings are passed as C arrays of character strings to Fortran: the first string may be usable if its length is passed separately. and I have been taking a look. The linkage sends char ** to Fortran. On the other hand, INTPR and DBLEPR assume Fortran character strings are char *. On all my systems DBLEPR works and .Fortran does not, but I do know of one compiler (Watcom Fortran for Windows NT) where the linkage really is equivalent to char **. Fortran in S takes the first string in a character vector and passes that as char * (except on the Watcom-compiled Windows version), as far as I can deduce without the source code. I think we should either ban character strings in .Fortran or follow the S prototype unless someone has a way around this. With different compilers on the same platform having different conventions whatever we do (except a ban) will be compiler-dependent. Any suggestions? -- Brian D. Ripley, ripley@stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272860 (secr) Oxford OX1 3TG, UK Fax: +44 1865 272595 -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-devel-request@stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
>>>>> Prof Brian Ripley writes:> Has anyone ever successfully used Fortran character strings with R? > ?Foreign says> R C Fortran > integer int * integer > .... > character char ** [compiler dependent]> Character strings are passed as C arrays of character > strings to Fortran: the first string may be usable if > its length is passed separately.> and I have been taking a look. The linkage sends char ** to Fortran. > On the other hand, INTPR and DBLEPR assume Fortran character strings > are char *. On all my systems DBLEPR works and .Fortran does not, but > I do know of one compiler (Watcom Fortran for Windows NT) where the > linkage really is equivalent to char **.> Fortran in S takes the first string in a character vector and passes > that as char * (except on the Watcom-compiled Windows version), as far > as I can deduce without the source code.> I think we should either ban character strings in .Fortran or follow > the S prototype unless someone has a way around this. With different > compilers on the same platform having different conventions whatever > we do (except a ban) will be compiler-dependent.> Any suggestions?Hmm ... this is someone not knowing what is going (i.e., me) commenting on this. I touched this once when porting Rousseeuw's cluster routines to R, maybe the thread is in the r-core archives. I seem to recall that someone told me that this was really a compiler-specific issue and hence could/should not be part of the API. (In the specific case, it was a 0/1 string so I found a different solution.) (Btw, why do we map integer to int * and not long *?) -k PS. A comment on ?.External: We have list void * (SEXP *) other void * (SEXP) I think this (showing the alternative in parenteses) may be confusing. Shouldn't we show the preferred method in the table and mention the alternative somewhere in the text following? -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-devel-request@stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._