From huzhou at hsph.harvard.edu  Wed Oct 26 23:07:38 2005
From: huzhou at hsph.harvard.edu (huanyu zhou)
Date: Wed, 26 Oct 2005 17:07:38 -0400
Subject: [Rd] Borland C++ and [R] dyn.load() for windows
Message-ID: <4364DEA5@www.webmail.hsph.harvard.edu>

Hi, 
I compiled a C program file on Borland C++ 5.5 compiler to get one dll output 
(as instructed in the file readme.package). 
The C program file is just the example on page 31 of "writing R extensions":

void convolve(double *a, int *na, double *b, int *nb, double *ab)
{
int i, j, nab = *na + *nb - 1;
for(i = 0; i < nab; i++)
ab[i] = 0.0;
for(i = 0; i < *na; i++)
for(j = 0; j < *nb; j++)
ab[i + j] += a[i] * b[j];
}

I used
"bcc32 -Ic:\Borland\bcc55\include -Lc:\Borland\bcc55\Lib -u- -6 -O2 -WDE 
c:\Borland\bcc55\convolve.c"
to get "convolve.dll". It seemed fine.

When I used dyn.load("C:\\Borland\\BCC55\\Bin\\convolve.dll") in R (Version 
2.0.1 ), it seemed fine also, no warning or error messages. However, when I 
used is.loaded("convolve") to check if it was loaded, it showed "False".

I am working on winXP.

What could be the possible reason for that?


thanks

huanyu



[Rd] Borland C++ and [R] dyn.load() for windows
huanyu zhou