help-gsl
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Help-gsl] Embedded GSL in Fortran 90


From: Steven Vancoillie
Subject: Re: [Help-gsl] Embedded GSL in Fortran 90
Date: Mon, 6 Oct 2008 13:27:50 +0200
User-agent: KMail/1.9.9

On Monday 06 October 2008 12:11:08 Eric Germaneau wrote:
> Dear gsl users,
> 
> I wish to use gsl in my Fortran 90 program.
> So far, I've written 2 C routines as the follwing:
> 
> *#include <gsl/gsl_rng.h>
> #include <gsl/gsl_randist.h>
> #include "gslwr.h"
> 
> static gsl_rng* r;
> 
> void rng_initialise__(int* s)
> {
> r = gsl_rng_alloc(gsl_rng_taus);
> gsl_rng_set(r, (unsigned long int)(*s));
> 
> void rng__(double* zetha)
> {
> *zetha = (double)gsl_rng_uniform_pos(r) ;
> }*
> 
> And my program in Fortran 90 looks like that:
> 
> *PROGRAM random
> IMPLICIT NONE
> integer :: seed = 0
> double precision :: zetha
> 
> call system_clock(seed)
> call rng_initialise(seed)
> call rng(zetha)
> PRINT*, "zetha=",zetha
> 
> END PROGRAM random
> *
> 
> I'm able to creat *.o file doing *icc -c gslwr.c* and *ifc -c gsl.f90*.
> But when I do *ifc gsl.o gslw.o* I get
> 
> /*gsl.o: In function `MAIN__':
> gsl.f90:(.text+0x2c): undefined reference to `rng_initialise_'
> gsl.f90:(.text+0x36): undefined reference to `rng_'*/
> 
> Does someone understand what's wrong with this?
> On the other hand I've heard about fgsl
> <http://www.lrz-muenchen.de/services/software/mathematik/gsl/fortran/index.html>.
> Dose someone use it?
> What do you think about it?
> 
> I thank you in advance,
> Best,
> 
> Eric.


Hi,

you could leave out the second underscore in the names of the C functions

grtz
Steven




reply via email to

[Prev in Thread] Current Thread [Next in Thread]