All,
I have a question about using c and splus.
To compile my c code I am using cygwin gcc.
gcc -c mh2.c
gcc -shared -o mh2.dll mh2.o
#
# splus code
mh2 <- function(m,start){
out <- numeric(m)
out[1] <- start
.C("mh2",
m=as.integer(m), norms=as.double(rnorm(m)),
unifs=as.double(runif(m)), out=as.double(out),
cand=as.double(numeric(m)),
accept=as.double(numeric(m)))
}
#
# I GET THE FOLLOWING ERRORS IN SPLUS
dll.load("C:\\temp\\mh2.dll") # S-PLUS/
> dll.load("C:\\temp\\mh2.dll")
[1] -2
dyn.open("C:\\temp\\mh2.dll") # S-PLUS/
> dyn.open("C:\\temp\\mh2.dll")
Warning messages:
"C:\temp\mh2.dll" can't be opened as a DLL; check
how it was loaded in: dyn.open("C:\\temp\\mh2.dll")
temp <- mh2(3000, 3)
plot(density(temp$out))1
Thanks in advance.
Joe
__________________________________________________________________________________________
Check out the New Yahoo! Mail - Fire up a more powerful email and get things
done faster.
(http://advision.webevents.yahoo.com/mailbeta)
|