On Tue, 2 Jun 2009, H c wrote:
> Hi,
>
> I'm new to calling C++/C programs from R and am having some trouble
getting
> started. Following Sigal Blay (Simon Fraser University)'s
instructions, I
> have a .c file called "useC1.c":
>
> /* useC1.c */
>
> void useC(int *i) {
> i[0] = 11;
> }
>
>
> This produces a .o file : "useC1.o" in a specified directory. I
then open
> R, set the proper directory and:
>
>
> dyn.load("useC1.o")
That's not what Sigal Blay's instructions say (if you mean
http://www.sfu.ca/~sblay/R-C-interface.txt) They say
dyn.load("useC1.so")
Now, that won't work either, because the correct extension under Windows
is .dll rather than .so (look at .Platform to see the correct extension
for your platform).
If you do
dyn.load("useC1.dll")
the rest of the instructions should work. They do for me on Vista.
-thomas
Thomas Lumley Assoc. Professor, Biostatistics
tlumley at u.washington.edu University of Washington, Seattle