Hello! I am truing to compile an R-package having c-code. I put foo.c in src/ folder and useDynLib("foo") in NAMESPACE file. When trying R CMD check, I got an error message that shared object 'foo' is not found. Then I did R CMD SHLIB foo.c first. However, after that, I got warnings from R CMD check that there is an object file in /src folder. Even worse is if I run R CMD SHLIB for Windows and for Linux and put in /src both foo.so and foo.dll. What I am doing wrong? I thought that only *.c is needed in src/, then, I read in someones advice that both the source and shared library must be in src/. What should be done if one wants to prepare for CRAN? Thanks! Best, Petar -- ##################################################################################### Petar Milin Department of Psychology, University of Novi Sad, Serbia & Laboratory for Experimental Psychology, University of Belgrade, Serbia Address: Dr Zorana Dindica 2, Novi Sad 21000, Serbia E-mail: pmilin<AT> ff.uns.ac.rs Tel.&Fax: +381 21 458 948 Official homepage (in Serbian): http://www.ff.uns.ac.rs/fakultet/ljudi/fakultet_odseci_psihologija_petar_milin.html Personal homepage: http://sites.google.com/site/pmilin/ #####################################################################################
On 03.06.2011 21:46, Petar Milin wrote:> Hello! > I am truing to compile an R-package having c-code. I put foo.c in src/ > folder and useDynLib("foo")Where "foo" is the name of your package, I hope. Does R CMD INSTALL yourpackage generate a packagename.so (or .dll)? If so, it is just the useSynLib() entry that fails. Or does R CMD INSTALL give any error message? Uwe Ligges > in NAMESPACE file. When trying R CMD check,> I got an error message that shared object 'foo' is not found. Then I did > R CMD SHLIB foo.c first. However, after that, I got warnings from R CMD > check that there is an object file in /src folder. Even worse is if I > run R CMD SHLIB for Windows and for Linux and put in /src both foo.so > and foo.dll. > What I am doing wrong? I thought that only *.c is needed in src/, then, > I read in someones advice that both the source and shared library must > be in src/. What should be done if one wants to prepare for CRAN? > > Thanks! > > Best, > Petar >
On 04.06.2011 09:37, Petar Milin wrote:> Dear Uwe, > Please, can you help me with this? > I simplified the situation: > I am using Debian testing i386 (also, I have VirtualBox with Win XP on it) > myPackage is the name of the package > and foo.c is in the src/ > in NAMESPACE I put: > useDynLib("foo") > export("f1", > "f2") > everything else is in appropriate place: data/, man/, R/, DESCRIPTION. > > And as you asked, R CMD INSTALL (or build --binary) generates > myPackage.so, but not foo.so. > How to proceed? Where I went wrong?Everything is alright and behaves as it should. The dll/so should be named as the package. Well, "foo" is just an example and should be replaced by your package's name. So my guess was right and you missed the point to replace the "foo" by the package name in useDynLib("foo") Best, Uwe Ligges> > Best, > Petar > > On 03/06/11 22:32, Uwe Ligges wrote: >> >> >> On 03.06.2011 21:46, Petar Milin wrote: >>> Hello! >>> I am truing to compile an R-package having c-code. I put foo.c in src/ >>> folder and useDynLib("foo") >> >> >> Where "foo" is the name of your package, I hope. >> Does R CMD INSTALL yourpackage generate a packagename.so (or .dll)? If >> so, it is just the useSynLib() entry that fails. Or does R CMD INSTALL >> give any error message? >> >> Uwe Ligges >> >> >> > in NAMESPACE file. When trying R CMD check, >>> I got an error message that shared object 'foo' is not found. Then I did >>> R CMD SHLIB foo.c first. However, after that, I got warnings from R CMD >>> check that there is an object file in /src folder. Even worse is if I >>> run R CMD SHLIB for Windows and for Linux and put in /src both foo.so >>> and foo.dll. >>> What I am doing wrong? I thought that only *.c is needed in src/, then, >>> I read in someones advice that both the source and shared library must >>> be in src/. What should be done if one wants to prepare for CRAN? >>> >>> Thanks! >>> >>> Best, >>> Petar >>> >> >