[Rd] Registering S3 class from external package
The package I'm working on can extract data from external packages but would otherwise have no dependency on them. However, I desire to be able to dispatch based on an external S3 class if its package is attached (.First.lib). My code is S4-based and its package has NAMESPACE. Registering the external class prior to the other package being attached doesn't seem to work so I am attempting to perform the registration once the other package has done so. But my namespace is locked by the time this occurs. Can someone either tell me how to do this, suggest a better alternative, or point me to another package that does something similar? Current attempt is something like the following: setHook(packageEvent("somepkg", "attach"), function(...) { cat("* Register", sQuote("oldstyle"), "as S3 class", "\n") setOldClass(c("oldstyle", "data.frame"), where = asNamespace("mypkg")) }) - > require(mypkg) Loading required package: mypkg ... > require(somepkg) Loading required package: somepkg * Register 'oldstyle' as S3 class Error in assign(classMetaName(Class), def, where) : cannot add bindings to a locked environment > R.version.string [1] "R version 2.1.1, 2005-06-20" -- SIGSIG -- signature too long (core dumped) __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
[Rd] include C functions from nmath in my own C functions
Hi: I followed the README in src/nmath/standalone/ to make the use the command "make shared" to make the libRmath.so file. I also add the directories containg libRmath.so to LD_LIBRARY_PATH by using command "export D_LIBRARY_PATH=$LD_LIBRARY_PATH:$/home/zhliu/Backup/R-2.0.1/src/nmath/standalon e " However, when I try to run the following codes by the command "gcc test.c -lRmath" on Linux Fedora Core 2, /***/ /* file name test.c */ #define MATHLIB_STANDALONE 1 #include int main() { /* something to force the library to be included */ qnorm(0.7, 0.0, 1.0, 0, 0); return 0; } /**/ the compiler gives me the following error message. It seems definitions of some R functions can not be found in the libRmath.so file. Anyone has any idea about this problem? Thank you very much! /usr/local/lib/libRmath.so: undefined reference to `expm1' /usr/local/lib/libRmath.so: undefined reference to `log' /usr/local/lib/libRmath.so: undefined reference to `sqrt' /usr/local/lib/libRmath.so: undefined reference to `rint' /usr/local/lib/libRmath.so: undefined reference to `cos' /usr/local/lib/libRmath.so: undefined reference to `sin' /usr/local/lib/libRmath.so: undefined reference to `pow' /usr/local/lib/libRmath.so: undefined reference to `sinh' /usr/local/lib/libRmath.so: undefined reference to `log10' /usr/local/lib/libRmath.so: undefined reference to `exp' /usr/local/lib/libRmath.so: undefined reference to `tan' /usr/local/lib/libRmath.so: undefined reference to `log1p' /usr/local/lib/libRmath.so: undefined reference to `hypot' collect2: ld returned 1 exit status __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] include C functions from nmath in my own C functions
On 8/11/05, yyan liu <[EMAIL PROTECTED]> wrote: > Hi: > I followed the README in src/nmath/standalone/ > to make the use the command "make shared" to make the > libRmath.so file. I also add the directories containg > libRmath.so to LD_LIBRARY_PATH by using command > "export > D_LIBRARY_PATH=$LD_LIBRARY_PATH:$/home/zhliu/Backup/R-2.0.1/src/nmath/standalon > e > " > However, when I try to run the following codes by the > command "gcc test.c -lRmath" on Linux Fedora Core 2, > /***/ > /* file name test.c */ > #define MATHLIB_STANDALONE 1 > #include > > int > main() > { > /* something to force the library to be included */ > qnorm(0.7, 0.0, 1.0, 0, 0); > return 0; > } > /**/ > > the compiler gives me the following error message. It > seems definitions of some R functions can not be found > in the libRmath.so file. Anyone has any idea about > this > problem? Thank you very much! > > > /usr/local/lib/libRmath.so: undefined reference to > `expm1' > /usr/local/lib/libRmath.so: undefined reference to > `log' > /usr/local/lib/libRmath.so: undefined reference to > `sqrt' > /usr/local/lib/libRmath.so: undefined reference to > `rint' > /usr/local/lib/libRmath.so: undefined reference to > `cos' > /usr/local/lib/libRmath.so: undefined reference to > `sin' > /usr/local/lib/libRmath.so: undefined reference to > `pow' > /usr/local/lib/libRmath.so: undefined reference to > `sinh' > /usr/local/lib/libRmath.so: undefined reference to > `log10' > /usr/local/lib/libRmath.so: undefined reference to > `exp' > /usr/local/lib/libRmath.so: undefined reference to > `tan' > /usr/local/lib/libRmath.so: undefined reference to > `log1p' > /usr/local/lib/libRmath.so: undefined reference to > `hypot' > collect2: ld returned 1 exit status > > __ > R-devel@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-devel Add -lm to the end of the call to gcc. You are missing functions from the math library. __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel