s-news
[Top] [All Lists]

Re: Fortran with "realpr" subroutine

To: Laura Holt <lauraholt_983@hotmail.com>
Subject: Re: Fortran with "realpr" subroutine
From: Prof Brian Ripley <ripley@stats.ox.ac.uk>
Date: Mon, 23 Aug 2004 08:04:56 +0100 (BST)
Cc: s-news@lists.biostat.wustl.edu
In-reply-to: <BAY12-F8jq65Rn8P5o7000587cf@hotmail.com>
On Mon, 23 Aug 2004, Laura Holt wrote:

> I wanted to write a Fortran program to accompany an S function.

*On Windows*, the only place where this is a problem, and using MinGW 
rather than Compaq/Digital Fortran as recommended.

Also, I will assume you are using S-PLUS 6.2, but you also did not say.

> The final program will include a call to "realpr".
> Here is a little test program:
> 
>       subroutine silly(x,y,n,m)
>       integer n,m
>       real x(n),y(n)
>       do 11 i=1,n
>          y(i)=x(i)**m
> 11      continue
>       call realpr("fake",4,y(2),1)
>       return
>       end
> 
> 
> 
> C:\MinGW\bin>g77 -O2 -c silly.f
> g77 -O2 -c silly.f
> 
> 
> C:\MinGW\bin>g77 -shared -o silly.dll silly.o
> g77 -shared -o silly.dll silly.o
> silly.o(.text+0x7e):silly.f: undefined reference to `realpr_'

Better to make S.dll as that is what S-PLUS loads automatically.

> C:\MinGW\bin>
> 
> Is there another way to compile this, or should I just do I "work around" 
> instead the realpr?

You need to link against the S-PLUS DLL.  Once you have an import library,
use e.g.

g77 -O2 -mrtd -c silly.f
g77 -shared -o S.dll silly.o -Lc:/S/splus62/lib/mingw -lSqpe

For more details, see the on-line complements to `S Programming' at
http://www.stats.ox.ac.uk/pub/MASS3/Sprog


-- 
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 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595


<Prev in Thread] Current Thread [Next in Thread>