Hi, I want to set up a dynamic link between a library e.g. myLibrary.a and a C++ file myProgram.cc to use in R. Is this possible? If so how does one go about doing it? Any help will be greatly appreciated. Cheers, Sam.
Sam - On CRAN, under "Manuals" I believe you will find one with a title similar to "Writing R extensions". The correct title will be given in the R FAQ. I think that's the one you want. - tom blackwell - u michigan medical school - ann arbor - On Mon, 1 Mar 2004, Samuel Kemp wrote:> Hi, > > I want to set up a dynamic link between a library e.g. myLibrary.a and a > C++ file myProgram.cc to use in R. Is this possible? If so how does one > go about doing it? > > Any help will be greatly appreciated. > > Cheers, > > Sam. > > ______________________________________________ > 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.html >
Hi, I managed to fixed my problem with linking a ".a" file (an archive of .o files) with the following..... g++ -I/usr/local/lib/R/include -I/usr/local/include -mieee-fp -fPIC -g -O2 -c fileGT.cc -o fileGT.o (i.e. the beginning bit of R CMD SHLIB) then I linked (underlined) the files with.... g++ -shared -L/usr/local/lib -o fileGT.so fileGT.o _-I/home/sekemp/Documents/ann_0.2/include -L/home/sekemp/Documents/ann_0.2/lib -lANN_ This is just for information incase any one else gets stuck on this problem and is googling around. There may be better ways where one does not need to type so much information into the compiler but hey it works! Cheers, Sam ---- Samuel Edward Kemp BSc (Hons) /Cardiff/, Neural & Evolutionary Computation Research Group, University of Glamorgan, Wales, UK.