dyn.load problem
O. Neto wrote:
Hi R-Users
I wrote 1 week ago asking about a message that appears when I try run
dyn.load.
I'm trying to do an example in C code from "Writing R Extension" to
learn how to do it.
I have R 2.0.0, Rtools, Perl and MinGW as describe in
http://www.murdoch-sutherland.com/Rtools/ with path sets.
Really, *really* sure you have followed all of readme.packages? Works for me.
When I use C:\R\rw2000\bin>RCMD SHLIB -o C:/dev-cpp/teste.dll C:/dev-cpp/conv.c
What is the output?
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.dll") 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)
My C code is (extracted form Writing 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);
}
I??m using RCMD under Windows ME.
How can I fix this? Someone can help me ? Prof. Ripley told me to catch
more information debbuging this DLL. Is it hard to do this one under
Windows? It??s necessary modify files SHLIB or MkDLL?
Not that easy as under Linux, at least. Uwe Ligges
Thanks O. Neto
______________________________________________ R-help at stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html