Re: [R] Load the shared object/DLL

From: Guohui Ding <gohidg_at_gmail.com>
Date: Wed, 16 Apr 2008 19:53:58 +0800

:) Thanks.

I owe you an apology and retract it, as I copied the codes from others and did not check the origin of these codes.

2008/4/16, Prof Brian Ripley <ripley_at_stats.ox.ac.uk>:
>
> On Wed, 16 Apr 2008, Guohui Ding wrote:
>
> Dear All,
> >
> > I have written a function in c (in a file named 'a.c') as follows,
> >
>
> *PLEASE* don't claim credit for the work of others (in this case it is me
> that you owe the apology and retraction to). That is from 'S Programming'
> p. 126, and '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];
> > }
> >
> > Then, I created a shared file in the Windows,
> >
> > R CMD SHLIB -d -o a.dll a.c
> >
> > Every thing is OK now.
> >
> > I changed the working directory of the R environment to the directory
> > containing the a.dll.
> > I enter two commands in the R console,
> >
> > dyn.load("a.dll")
> > > is.loaded("a")
> > >
> > [1] FALSE
> >
> > The question is that, why was the "a.dll" failed to be loaded in the R
> > enviroment? Which step resuted in this problem?
> >
>
> It did not fail. is.loaded("a") looks for entry point "a", and you have
> "convolve".
>
> Any suggestion was welcome.
> >
>
> Do note that posting guide said about where to post non-R programming
> questions.
>
>
> > G. Ding
> >
> > [[alternative HTML version deleted]]
> >
> > ______________________________________________
> > R-help_at_r-project.org mailing list
> > https://stat.ethz.ch/mailman/listinfo/r-help
> > PLEASE do read the posting guide
> > http://www.R-project.org/posting-guide.html<http://www.r-project.org/posting-guide.html>
> > and provide commented, minimal, self-contained, reproducible code.
> >
> >
> --
> Brian D. Ripley, ripley_at_stats.ox.ac.uk
> Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/
> University of Oxford, Tel: +44 1865 272861 (self)
> 1 South Parks Road, +44 1865 272866 (PA)
> Oxford OX1 3TG, UK Fax: +44 1865 272595

        [[alternative HTML version deleted]]



R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Wed 16 Apr 2008 - 12:29:16 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Wed 16 Apr 2008 - 12:30:29 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive