[R-pkg-devel] DLL requires the use of native symbols

Dirk Eddelbuettel edd @end|ng |rom deb|@n@org
Mon Mar 20 22:32:19 CET 2023


On 20 March 2023 at 21:25, Guido Kraemer wrote:
| Thanks for the pointers! I think I fixed it. Here is what I did [1]. To 
| be honest, I am not sure what was wrong before, but I followed [2], 
| especially the code box at the very end of the section. I wonder if this 
| was always wrong or if the R internals changed at some point.
| 
| 
| [1] 
| https://github.com/gdkrmr/coRanking/commit/012c3e340ba64e7da0adab38c8927a92dfebe432#diff-993bc9d43b232315c8f4edcd1823237e621593cd1186436fe42783c6240d4d1fL128

Looks good.
 
| [2] 
| https://cran.r-project.org/doc/manuals/r-release/R-exts.html#Converting-a-package-to-use-registration

Sure. I think your main issue was that you were "almost there" but didn't
actually go through calling as symbols, and the very recent change of having
R_forceSymbols() then error caught you out.

But all good now, and that's why we have checks and balances.

(One micro nit for something else I noticed: you have a nice pkgdown site,
but not linked to it anywhere.)

Cheers, Dirk

| 
| On 3/20/23 17:56, Dirk Eddelbuettel wrote:
| > On 20 March 2023 at 12:43, Duncan Murdoch wrote:
| > | It appears that you have some uses of .Call() where you are passing a
| > | character variable as the first argument, instead of registering the
| > | entry point and passing the variable containing the registration
| > | information.
| >
| > Correct. And to make the case worse, the package then calls (on line 130 of
| > coranking_main.cpp) the very 'R_forceSymbols(info, TRUE);' that is now
| > telling it about the error of using _quoted_ ("text") rather than symbol
| > references. Just removing line 130 may work.
| >   
| > |  From your second link, it looks like Rcpp has some special way to
| > | handle entry point registration.  I'm not familiar with that, I use the
| > | basic way described in Writing R Extensions, section 5.4 "Registering
| > | native routines".
| >
| > Rcpp checks if a useDynLib("nameofpackage") has `, .registration=TRUE)` and
| > if so, creates glue code with symbols (ie what Guido desires here) instead of
| > text variables (as was common a long time ago).
| >
| > That was the case of package 'sf' which I helped yesterday; all it took there
| > was to ensure it used `useDynLib("sf", .registration=TRUE)` and to re-create
| > the generated RcppExports.R via Rcpp's own `compileAttributes()` function (as
| > I did in PR that Edzer merged hours later).
| >
| > But none of this helps Guido as his package prefers to do it all by hand --
| > which is perfectly fine and valid, of course -- but a little bit more work.
| >
| > Hth, Dirk
| >
| -- 
| 
| Dr. Guido Kraemer
| Remote Sensing Center for Earth System Research
| Uni Leipzig
| Talstr. 35
| D-04103 Leipzig
| Germany
| 
| https://rsc4earth.de/authors/gkraemer/
| https://www.guido-kraemer.com
| https://twitter.com/gdkrmr
| 
| Phone: +49 1577 6099439
| Email:guido.kraemer using uni-leipzig.de
| 
| [DELETED ATTACHMENT smime.p7s, application/pkcs7-signature]

-- 
dirk.eddelbuettel.com | @eddelbuettel | edd using debian.org



More information about the R-package-devel mailing list