On 11 May 2017 at 12:16, Patrick Perry wrote: | I've done a bit more investigation into this issue. Here is my current | understanding of the situation: | | 1. I have a package on CRAN (corpus-0.3.1) that passes tests on all | platforms except for Linux. | 2. My package defines a C function, "xrealloc", for internal use. | 3. The libreadline library that R links to defines a different version | of "xrealloc". | 4. On Linux, when I load my package, references to "xrealloc" get linked | to the libreadline version of that function. | 5. This causes one of my tests to fail, calling exit(2), because the | libreadline version of xrealloc does not allow calls of the form | "xrealloc(ptr, 0)". | | I can work around this issue pretty easily, by either renaming my | version of xrealloc to something else, or by avoiding calls of the form | "xrealloc(ptr, 0)". So, this is not a major issue, but it's a little | unsettling to see this behavior when my package does not explicitly link | to or use anything from libreadline. | | Is there a reason this behavior is only manifesting on Linux? Is there | something wrong with the way I'm compiling my package on that platform? | Is this just some quirk about the way R is loading dynamic libraries on | Linux? I'd appreciate any insight into the issue.
It may just be the flat namespace and linking order. AFAIK there is nothing in C preventing so maybe you 'just got lucky' on the other platforms. See eg http://stackoverflow.com/questions/7998770/ But then I don't use pure C that after anymore ... and in C++ you could just wrap a namespace around your code, avoiding the issue. Dirk -- http://dirk.eddelbuettel.com | @eddelbuettel | e...@debian.org ______________________________________________ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel