[R] Problem with dyn.load()
Prof Brian Ripley
ripley at stats.ox.ac.uk
Sun Nov 7 16:54:16 CET 2004
Please do read the help file before posting. as the posting guide asks.
?dyn.load says
x: a character string giving the pathname to a shared library or
DLL.
Your DLL is "teste.dll", not "teste": you probably do have a file "teste"
that is not a DLL or you would get a more informative error message.
That's not a mistake I have ever seen reported on R-help.
On Sun, 7 Nov 2004, O. Neto wrote:
> Hi!
>
> I am studying C language to run with R 2.0.0. My system (Windows ME /BR) is configured to run RCMD ( I have installed ActivePerl, Rtools and MinGW as indicated in http://www.murdoch-sutherland.com/Rtools/ an with correct path).
> I would like run the coded write below named conv.c (Example from "Write R Extension") :
>
> #include <R.h>
> #include <Rinternals.h>
> SEXP convolve2(SEXP a, SEXP b)
> {
> R_len_t i, j, na, nb, nab;
> double *xa, *xb, *xab;
> SEXP ab;
>
> PROTECT(a = coerceVector(a, REALSXP));
> PROTECT(b = coerceVector(b, REALSXP));
> na = length(a); nb = length(b); nab = na + nb - 1;
> PROTECT(ab = allocVector(REALSXP, nab));
> xa = REAL(a); xb = REAL(b);
> xab = REAL(ab);
> for(i = 0; i < nab; i++) xab[i] = 0.0;
> for(i = 0; i < na; i++)
> for(j = 0; j < nb; j++) xab[i + j] += xa[i] * xb[j];
> UNPROTECT(3);
> return(ab);
> }
>
> When I use C:\Arquiv~1\R\rw2000\bin>RCMD SHLIB -o
> C:/dev-cpp/teste.dll c:/dev-cpp/conv.c a teste.dll is created without
> error and located in that directory, but when I use it in RGui with
> "Change dir" set to C:/dev-cpp :
>
> >dyn.load("teste") results:
> Error in dyn.load(x, as.logical(local), as.logical(now)) :
> unable to load shared library "C:/Dev-Cpp/teste":
> LoadLibrary failure: Parâmetro incorreto. (Incorrect Parameter)
>
> I tried find help in R-help, but none answers my questions.
> My doubts are: Why does it occur? How do I fix it? How I can include
> directives in RCMD -SHLIB, for example, conv.def file to mangling names?
> It is editing Makevars.win?
> If anybody have time to answer my question, I apreciate.
>
> Thanks,
>
> O. Neto
>
> PS: There is any discussion list of R in portuguese? I can't find one.
>
>
>
>
> [[alternative HTML version deleted]]
Please do note what the posting guide says about this!
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
--
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 272866 (PA)
Oxford OX1 3TG, UK Fax: +44 1865 272595
More information about the R-help
mailing list