s-news
[Top] [All Lists]

Re: c code & splus

To: "Joe Cerniglia" <cj5815@yahoo.com>
Subject: Re: c code & splus
From: "Yingfu Xie" <Yingfu.Xie@sekon.slu.se>
Date: Tue, 31 Oct 2006 17:39:56 +0100
Cc: <s-news@lists.biostat.wustl.edu>
In-reply-to: <20061030200433.95354.qmail@web50405.mail.yahoo.com>
Keywords: disclaimer
Thread-index: Acb8YjVm5bYeQE2vTlWTtwFTD9THnAAp9IXA
Thread-topic: [S] c code & splus
Hello,

Are you following the guide from book 'S programming' by Venables &
Ripley?  I just want to remind you that, according to the on-line update
of this book, the cygwin gcc compiler are no longer supported by S-plus.
Instead, you can use MinGW compiler. That works well.
By the way, I had the same experience before and was corrected by Prof.
Ripley.

HTH,
Yingfu

-----Original Message-----
From: s-news-owner@lists.biostat.wustl.edu
[mailto:s-news-owner@lists.biostat.wustl.edu] On Behalf Of Joe Cerniglia
Sent: den 30 oktober 2006 21:05
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
###########################################

This message has been scanned by F-Secure Anti-Virus for Microsoft Exchange.
For more information, connect to http://www.f-secure.com/

<Prev in Thread] Current Thread [Next in Thread>