Change the compiler commands to:
gcc -mno-cygwin -c mh2.c
gcc -mno-cygwin -shared -o mh2.dll mh2.o
And see if that fixes the problem.
Just out of curiosity, where did you get the instructions that you are
following? The code that you have tried so far looks nearly identical
to something I wrote a few years ago, is it still floating around out
there?
--
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.snow@intermountainmail.org
(801) 408-8111
-----Original Message-----
From: s-news-owner@lists.biostat.wustl.edu
[mailto:s-news-owner@lists.biostat.wustl.edu] On Behalf Of Joe Cerniglia
Sent: Monday, October 30, 2006 1:05 PM
To: s-news@lists.biostat.wustl.edu
Subject: [S] c code & splus
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)
--------------------------------------------------------------------
This message was distributed by s-news@lists.biostat.wustl.edu. To
unsubscribe send e-mail to s-news-request@lists.biostat.wustl.edu with
the BODY of the message: unsubscribe s-news
|