Calling GSL functions from Fortran ?

Jacek Pliszka pliszka@phyun0.ucr.edu
Mon Apr 29 13:22:00 GMT 2002


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




More information about the Gsl-discuss mailing list