[R] Questions about Preserving registers

Uwe Ligges ligges at statistik.uni-dortmund.de
Thu Jun 10 17:59:58 CEST 2004


Rui wrote:

> Hi folks,
>  
> I tried to use Mirosoft Fortran Powerstation 4.0 to create a dll file.

And what is the reason not to use the recommended gcc?

Uwe Ligges


> However, when I used the command dyn.load("test.dll"), I got the
> following message:
>  
> NULL
> Warning message: 
> DLL attempted to change FPU control word from 9001f to 90003
>  
> I read the instruction on Duncan Murdoch’s website about preserving
> registers, but I still don’t understand it. For example,
>  
> 1. On first entry to the DLL, set the control word to the standard R
> value, then save that as the Delphi default. Put this code in the
> library module:
> ## My question: Is that mean put the following code in my Fortran
> routine without any change based on the message I got? 
>  
> procedure Rwin_fpset; cdecl; external 'R.dll';
>  
> function Get8087CW:word;
> begin
>   asm
>     fstcw result
>   end;
> end;
>  
> begin
>   Rwin_fpset();
>   Set8087CW(Get8087CW);
> end.
>  
> 2. After any operation that may have changed the status word, put this
> call before returning to R:
> ##  My question: where do I put the line below?
>  
>   Set8087CW(Default8087CW);
>  
>  
> 3. The following function may be useful in debugging; it returns false
> when the control word has been unexpectedly changed:
>  
> function Okay8087CW:boolean;
> begin
>   result := ((Default8087CW xor Get8087CW) and not $E060) = 0;
> end;
>  
> Thanks.
>  
> Rui
>  
> Phone: (403)220-4501
> Email: rwang at math.ucalgary.ca
> Department of Mathematics and Statistics
> University of Calgary
>  
> 
> 	[[alternative HTML version deleted]]
> 
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html




More information about the R-help mailing list