[R-pkg-devel] Error in inDL(x, as.logical(local), as.logical(now), ...) unable to load shared object

Ezra Tucker ezr@ @end|ng |rom |@ndtucker@com
Thu Dec 23 16:52:13 CET 2021


Hi Tomas and Dirk,


Thanks for your suggestions! Between the two, got it working. I didn't
know Windows didn't do rpath, I think that you're right that setting the
PATH would have helped. I haven't seen that in an R package before, so I
did what was in the Rblpapi package, which was creating a couple of
copies of the dll in question.


On a related note, in Rblpapi Makevars.win line 47 it's downloading and
extracting the compiled library from GitHub. My understanding is that
one shouldn't include pre-compiled libraries in R packages for security
reasons, at least not for submitting to CRAN. Is doing it this way a
good way around that?


Thanks again!

-Ezra


On 12/23/21 09:34, Dirk Eddelbuettel wrote:
> On 23 December 2021 at 11:07, Tomas Kalibera wrote:
> | You can have a look at CRAN package Rblpapi which is using an external DLL.
>
> Yes with one big caveat: You have to make sure the library follows what is
> the "hour-glass pattern": it needs to have an internal (the "narrow" part) C
> library covering the wider underlying library and offered via a wider header.
>
> Only C linkage works across different compiler families. You just cannot use
> a Virtual C++-made Windows DLL from R's MinGW g++ compiler with C++.
>
> But you can use C linkage.  So some libraries (such as the Bloomberg API used
> in Rblpapi and the TileDB API used in the tiledb package (when not using a
> local build) can use a library following the hourglass pattern:
>
>   - "wide" bottom layer (may be C++ or C) with the core implementation
>
>   - "narrow" C layer accessing the bottom and priving an API providing via C
>     which profits from C's portable foreign function interface
>
>   - "wide" layer on top via a header-only C++ file accesssing the C and
>     which the C++ compiler optimizes away so that the C API is used for linking
>
> Sounds complicated, but works great.
>
> Good detail is in a hour-long but not-too-technical talk here
>
>   https://www.youtube.com/watch?v=PVYdHDm0q6Y
>
> and slides etc are here
>
>   https://github.com/CppCon/CppCon2014/tree/master/Presentations/Hourglass%20Interfaces%20for%20C%2B%2B%20APIs
>
> Dirk
>
> --
> https://dirk.eddelbuettel.com | @eddelbuettel | edd using debian.org



More information about the R-package-devel mailing list