Hi, I am willing to load multiple C files to R, which are inter-dependent (functions used in one may be defined in other). What I was trying is to first compile all of them separately (using R CMD SHLIB ...) and then load them one by one (using dyn.load("...") ), but it doesnt work (which seems to be obvious). During loading, it was unable to recognize the functions declared in already loaded file. Please help. Is there any documentation available on this topic, other than "Writing R extensions"? Thanks, Utsav
On Tue, 15 Jun 2004, Utsav Boobna wrote:> Hi, > I am willing to load multiple C files to R, which > are inter-dependent (functions used in one may be > defined in other). What I was trying is to first > compile all of them separately (using R CMD SHLIB ...) > and then load them one by one (using dyn.load("...") > ), but it doesnt work (which seems to be obvious). > During loading, it was unable to recognize the > functions declared in already loaded file. > > Please help. > Is there any documentation available on this topic, > other than "Writing R extensions"?Which is sufficient, as it tells you This accepts as arguments a list of files which must be object files (with extension @file{.o}) or C, C++, or FORTRAN sources (with extensions @file{.c}, @file{.cc} or @file{.cpp} or @file{.C}, and @file{.f}, respectively). See @kbd{R CMD SHLIB --help}, or the on-line help for @code{SHLIB}, for usage information. Did you not notice `a list of files'? You should be calling R CDM SHLIB only once. -- 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
On Tue, Jun 15, 2004 at 01:43:21AM -0700, Utsav Boobna wrote:> Hi, > I am willing to load multiple C files to R, which > are inter-dependent (functions used in one may be > defined in other). What I was trying is to first > compile all of them separately (using R CMD SHLIB ...) > and then load them one by one (using dyn.load("...") > ), but it doesnt work (which seems to be obvious). > During loading, it was unable to recognize the > functions declared in already loaded file. > > Please help. > Is there any documentation available on this topic, > other than "Writing R extensions"? > > Thanks, > Utsav > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > https://www.stat.math.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide! http://www.R-project.org/posting-guide.htmlDear Utsav, I think that you missed an option in dyn.load(). You can load your program by dyn.load("your.program",local=FALSE) Good luck. Jin