This is the mail archive of the gsl-discuss@sources.redhat.com mailing list for the GSL project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Calling GSL functions from Fortran ?


On Mon, 29 Apr 2002, Daniel T Konkle wrote:

> Has anyone out there used the GSL library with Fortran?
> 
> I'm looking for an example of calling one of the function from Fortran.

Write a simple C wrapper. Like this:

double my_gsl_ran_gaussian_(double *sigma){
  return(gsl_ran_gaussian(gsl_rng_mt19937,*sigma))
}


Remember:
a) on some systems you have to add _ or __ to the name
b) fortran passes everything as reference so you have to go with pointers
c) may depend on compiler

For Linux g77/gcc add _

Good Luck,

Jacek



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]