Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I take a slightly different reading of "Writing R Extensions". Paragraph 1 of Section 5.8.1 (dealing with unix-like operating systems) says that it's possible but not portable or recommended to link to a <em>shared</em> library. Paragraph 2 says <em>static</em> libraries are ok (the 'This' at the head of the paragraph is confusing; what does it refer to?) because the static library provided by packA can be discovered by packB when packB is installed, and is then incorporated into the dynamic library. This requires that packA provides a static library, and hence that packA realized that it's role was to do this; many packages will instead think of their role as providing an R interface to a subset of the functionality of the library that they wrap, and provide a shared object that links to the shared library in its own package.</p> <p>An example is the <a href="http://bioconductor.org/packages/2.10/bioc/html/Rsamtools.html" rel="noreferrer">Rsamtools</a> package in Bioconductor, which creates static versions of the samtools library and provides a (tricky-to-get-right) mechanism for packages wanting to access the static library (a <a href="http://bioconductor.org/packages/2.10/bioc/vignettes/Rsamtools/inst/doc/Rsamtools-UsingCLibraries.pdf" rel="noreferrer">vignette</a> provides a dependent package view of things). It's important to provide the absolute path to the static library <code>PKG_LIBS="-l$(PKGB_PATH)/libpackB.a"</code> to avoid static linking to the same library provided by the system (with the headers provided by packA).</p> <p>@DirkEddelbuettel has almost surely gone down this road himself, and will point out my errors. I agree with his comment below that using a static library is sub-optimal (primarily from the memory consumption perspective?) but make the choice to avoid the portability reasons alluded to in paragraph 5.8.1.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload