Re: [R] Calling rand_unif() from fortran

About this list Date view Thread view Subject view Author view Attachment view

From: Prof Brian D Ripley (ripley@stats.ox.ac.uk)
Date: Mon 16 Jul 2001 - 16:39:37 EST


Message-id: <Pine.GSO.4.31.0107160737490.1160-100000@auk.stats>

On Sat, 14 Jul 2001, Gregory R. Warnes wrote:

>
> What is the necesary incantation to call rand_unif() from a fortran
> routine?
>
> Just inserting rand_unif() into the fortran code compiles OK, but won't
> dyn.load():
>
>
> > dyn.load("forest.so")
> Error in dyn.load(x, as.logical(local), as.logical(now)) :
> unable to load shared library "/home/warnes/R/forest/forest.so":
> /home/warnes/R/forest/forest.so: undefined symbol: unif_rand__
>
>
> Do I have to write a bit of C code to "wrap" the call using F77_SUB?

Yes. In general you cannot call C entry points from Fortran. That
includes GetRNGstate and PutRNGstate which you *must* use too.

-- 
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-help 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-help-request@stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._


About this list Date view Thread view Subject view Author view Attachment view

This archive was generated by hypermail 2.1.3 : Wed 10 Mar 2004 - 08:18:19 EST