Re: [R] dyn.load problem
Hi, Uwe. Thank you for help. Yesterday another R-user Mr. Ramasamy told me to do a simple program such as (changing too the directories, now C:/minhadll/): /*file conv.c*/ #include R.h void printhello (){ Rprintf(%s, hello world\n); } When I use C:\R\rw2000\binRCMD SHLIB -o c:/minhadll/meuteste.dll c:/minhadll/conv.c to compile this one. Below is the output. C:\R\rw2000\bin RCMD SHLIB -o c:/minhadll/meuteste.dll c:/minhadll/conv.c making c:/minhadll/conv.d from c:/minhadll/conv.c gcc -IC:/R/RW2000/include -Wall -O2 -c c:/minhadll/conv.c -o c:/minhadll/conv.o ar cr c:/minhadll/meuteste.a c:/minhadll/conv.o ranlib c:/minhadll/meuteste.a gcc --shared -s -o c:/minhadll/meuteste.dll c:/minhadll/meuteste.def c:/minhadll/meuteste.a -LC:/R/RW2000/src/gnuwin32 -lg2c -lR The result is meuteste.dll located in C:/minhadll/meuteste.dll. Now, talking about paths: I believe that I have make a correct way... but I'll list here to you: SET PATH=C:\Rtools\;C:\Perl\bin\;C:\MinGW\bin;C:\R\rw2000\include\ Is it correct? Thank you again for help me. I'm trying to do a dll for 3 weeks or more, without a good result. PS: The same error dyn.load appears O. Neto __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] dyn.load problem
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. When I use C:\R\rw2000\binRCMD 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.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? Thanks O. Neto __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] Problem with dyn.load()
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\binRCMD 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]] __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Problem with dyn.load()
Prof. Ripley, I would, initially, thank you for help me. I did what you did say, I called that dll ( by teste.dll as wrote in ?dyn.load). It did not work. I make a new dll for testing and again, it didn´t work, the same message appears. I don´t know how I fix it. I have no idea. I´ll read all writing R extension again. I believe that my mistake is in config MKRules. Thank you again for spend your time with my doubts. I´m grateful. O. Neto __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html