Skip to content
Back to formatted view

Raw Message

Message-ID: <5.0.2.1.0.20010610225204.00a598e0@eno.princeton.edu>
Date: 2001-06-11T03:52:42Z
From: Richard Condit
Subject: load C code into R

I am trying to load C routines into R on windows, going through the the 
book S programming and the R manual, but I know I am missing some steps.

I created a win32 DLL project in Visual C++ (ver. 6.0).  It consists of one 
simple routine named test which accepts one *integer argument and one 
*double argument and performs a trivial computation.  The dll is named 
test.dll.

In R1022 for Windows, I run

 >dyn.load("d:/programs/library/test/test.dll")
 >testr_function(a,x) 
.C"d:/programs/library/test/test",as.integer(a),as.double(x))

These are both accepted, and I can use dyn.unload as well with test.dll.  I 
notice that while loaded, Visual C++ cannot recompile test.dll.

But when I try

 >testr(10,x)

I get the message ?Error in .C("test", as.integer(a),as.double(x)) : 
C/Fortran function name not in load table?.

I know I need a link step, or an install step, but I am missing something 
in the instructions.  Perhaps just a quick piece of advice could get me to 
the next stage



Richard Condit
Smithsonian Tropical Research Institute



-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._