[R] Dll problem

Yves Gauvreau cyg at sympatico.ca
Wed Dec 27 18:01:43 CET 2000


I've managed to make it work (the DLL).

For those interested here is what I did and assuming a full R 1.2.0
installation.

I ran make from Drive:\R\rw1020\src\gnuwin32 => to get libR.a
I created a directory where I put a copy of makeDll also found in
Drive:\R\rw1020\src\gnuwin32
I copied my Fortran files in there as well.
I edited makeDll adding DLLNAME=stochastic in this case and
RHOME=Drive:\R\rw1020
and ran make -f MakeDll

I'm sure there are better ways to do this, but this one worked.

Regards and special thanks to prof. Ripley for is kind words and patience.

Yves Gauvreau




> -----Message d'origine-----
> De : Prof Brian Ripley [mailto:ripley at stats.ox.ac.uk]
> Envoye : Wednesday, December 27, 2000 9:56 AM
> A : Yves Gauvreau
> Objet : RE: [R] Dll problem
>
>
> On Wed, 27 Dec 2000, Yves Gauvreau wrote:
>
> > Hi again,
> >
> > I downloaded and installed the suggested software from
> > http://www.stats.ox.ac.uk/pub/Rtools/
> > that is tools.zip, bin-msvcrt-2000-03-27.zip,
> > binutils-19990818-1-msvcrt.zip, and gcc-2.95.2-1-msvcrt.zip.
> Just to make
> > sure.
> >
> > I setup the path to these.
> >
> > As I did previously for R 1.1.1 I ran the following commands
> >
> > g77 -c  -mrtd -O2  -o stochastic.o stochastic.f
> > dllwrap -s --export-all --output-def stochastic.def
> --driver-name g77 -o
> > stochastic.dll stochastic.o
>
> Well, that's not in our documentation, is it?  Try out Rcmd SHLIB if you
> just want to make a DLL.
>
>
> > This is the R function I wrote to use the DLL which still works
> fine under R
> > 1.1.1. and not under R 1.2.0
> >
> > fast.stochastic <- function(cp=qc,lp=ql,hp=qh,nk=5,nd=3){
> >   if(!is.loaded(symbol.For("dfsto"))) dyn.load("g:\\stochastic.dll")
> >   #CP,LP,HP,PK,PD,HS,LS,LV,LENK,LEND
> >   hs <- ls <- pk <- pd <- rep(0.0, length(cp))
> >
> >   Tmat <- .Fortran("dfsto",
> >                    as.double(cp),
> >                    as.double(lp),
> >                    as.double(hp),
> >                    as.double(pk),
> >                    as.double(pd),
> >                    as.double(hs),
> >                    as.double(ls),
> >                    as.integer(length(cp)),
> >                    as.integer(nk),
> >                    as.integer(nd))
> >   data.frame(PK=Tmat[[4]], PD=Tmat[[5]])
> >
> > }
> >
> > As you can see I haven't made a package I just try to use the dynamic
> > library directly. I tried using the DLL from Excel and other VBA aware
> > software and there is no problem.
>
> > How come it doesn't work with R 1.2.0 and/or what should I do to make it
> > work?
>
> What does ``doesn't work with R 1.2.0'' mean?  If you had given something
> along the lines of the information requested for a bug report, I might
> have been prepared to help.
>
> > I have no idea and there's nothing in "CHANGES" to give me a clue.
>
> > Nota: The file README.packages isn't part of the Windows binary
> distribution
> > but in the R source files.
>
> It *is* in rw1020sp.zip.  If you want help, don't contradict accurate
> information.
>
> I hope you now manage to solve this on your own.
>
> >
> > Regards
> >
> > Yves Gauvreau
> >
> >
> > > -----Message d'origine-----
> > > De : owner-r-help at stat.math.ethz.ch
> > > [mailto:owner-r-help at stat.math.ethz.ch]De la part de Prof Brian Ripley
> > > Envoye : Wednesday, December 27, 2000 3:11 AM
> > > A : Yves Gauvreau
> > > Cc : r-help at stat.math.ethz.ch
> > > Objet : Re: [R] Dll problem
> > >
> > >
> > > On Wed, 27 Dec 2000, Yves Gauvreau wrote:
> > >
> > > > Hi,
> > > >
> > > > Where should I look to find out the reason why my Fortran DLL's
> > > don't work
> > > > any more?
> > >
> > > The CHANGES file in Windows?
> > >
> > > rw1020
> > > ======
> > >
> > > This version has been compiled against msvcrt.dll not crtdll.dll.
> > > This gives small speed increases and generally more accurate results.
> > > Packages compiled against crtdll.dll will still work (as far as we are
> > > aware), but for best results should be re-compiled.  (A few packages
> > > need to be re-compiled for 1.2.0 on all platforms, and any that used
> > > malloc directly need to be recompiled on this one.)
> > >
> > >
> > > Did you re-compile against msvcrt?  We have compiled up a lot
> of Frotran
> > > code, both in R itself and in contributed packages, and seen only
> > > small changes.  (Quite a few Fortran-based packages do use
> malloc directly
> > > and so do need to be re-compiled, but they will not load otherwise.)
> > >
> > > The recommended compilers have changed: see README.packages.  As far
> > > as I know the old ones still work.
> > >
> > >
> > > > *** This is the current version ***
> > > > platform i386-pc-mingw32
> > > > arch     x86
> > > > os       Win32
> > > > system   x86, Win32
> > > > status
> > > > major    1
> > > > minor    2.0
> > > > year     2000
> > > > month    12
> > > > day      15
> > > > language R
> > > >
> > > > *** This was the previous version ***
> > > > platform Windows
> > > > arch     x86
> > > > os       Win32
> > > > system   x86, Win32
> > > > status
> > > > major    1
> > > > minor    1.1
> > > > year     2000
> > > > month    August
> > > > day      15
> > > > language R
> > > >
> > > > The problem seem to be with the result I get back from the
> function call
> > > > which is not what it use to be. I search a bit for obvious change in
> > > > R-ext.pdf to no avail.
> > >
> > > That's not going to tell you about changes, let alone
> platform-specific
> > > ones.
> > >
> > > >
> > > > Thank in advance.
> > > >
> > > > Yves Gauvreau
> > > >
> > > >
> > > >
> > > -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.
> > > -.-.-.-.-.-.-
> > > > 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 at stat.math.ethz.ch
> > >
> >
> _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._.
> _._._._._.
> > _._
> > >
> >
> > --
> > Brian D. Ripley,                  ripley at 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 at stat.math.ethz.ch
>
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._.
> _._
>
> -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.
-.-.-
> 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 at stat.math.ethz.ch
>
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._.
_._
>

--
Brian D. Ripley,                  ripley at 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 at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list